about summary refs log tree commit diff stats
path: root/ui-blame.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-blame.c')
-rw-r--r--ui-blame.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/ui-blame.c b/ui-blame.c index 08832cd..4adec2b 100644 --- a/ui-blame.c +++ b/ui-blame.c
@@ -10,7 +10,7 @@
10#include "ui-blame.h" 10#include "ui-blame.h"
11#include "html.h" 11#include "html.h"
12#include "ui-shared.h" 12#include "ui-shared.h"
13#include "argv-array.h" 13#include "strvec.h"
14#include "blame.h" 14#include "blame.h"
15 15
16 16
@@ -48,7 +48,7 @@ static void emit_blame_entry_hash(struct blame_entry *ent)
48 unsigned long line = 0; 48 unsigned long line = 0;
49 49
50 char *detail = emit_suspect_detail(suspect); 50 char *detail = emit_suspect_detail(suspect);
51 html("<span class='sha1'>"); 51 html("<span class='oid'>");
52 cgit_commit_link(find_unique_abbrev(oid, DEFAULT_ABBREV), detail, 52 cgit_commit_link(find_unique_abbrev(oid, DEFAULT_ABBREV), detail,
53 NULL, ctx.qry.head, oid_to_hex(oid), suspect->path); 53 NULL, ctx.qry.head, oid_to_hex(oid), suspect->path);
54 html("</span>"); 54 html("</span>");
@@ -104,7 +104,7 @@ static void print_object(const struct object_id *oid, const char *path,
104 enum object_type type; 104 enum object_type type;
105 char *buf; 105 char *buf;
106 unsigned long size; 106 unsigned long size;
107 struct argv_array rev_argv = ARGV_ARRAY_INIT; 107 struct strvec rev_argv = STRVEC_INIT;
108 struct rev_info revs; 108 struct rev_info revs;
109 struct blame_scoreboard sb; 109 struct blame_scoreboard sb;
110 struct blame_origin *o; 110 struct blame_origin *o;
@@ -124,15 +124,16 @@ static void print_object(const struct object_id *oid, const char *path,
124 return; 124 return;
125 } 125 }
126 126
127 argv_array_push(&rev_argv, "blame"); 127 strvec_push(&rev_argv, "blame");
128 argv_array_push(&rev_argv, rev); 128 strvec_push(&rev_argv, rev);
129 init_revisions(&revs, NULL); 129 init_revisions(&revs, NULL);
130 revs.diffopt.flags.allow_textconv = 1; 130 revs.diffopt.flags.allow_textconv = 1;
131 setup_revisions(rev_argv.argc, rev_argv.argv, &revs, NULL); 131 setup_revisions(rev_argv.nr, rev_argv.v, &revs, NULL);
132 init_scoreboard(&sb); 132 init_scoreboard(&sb);
133 sb.revs = &revs; 133 sb.revs = &revs;
134 sb.repo = the_repository; 134 sb.repo = the_repository;
135 setup_scoreboard(&sb, path, &o); 135 sb.path = path;
136 setup_scoreboard(&sb, &o);
136 o->suspects = blame_entry_prepend(NULL, 0, sb.num_lines, o); 137 o->suspects = blame_entry_prepend(NULL, 0, sb.num_lines, o);
137 prio_queue_put(&sb.commits, o->commit); 138 prio_queue_put(&sb.commits, o->commit);
138 blame_origin_decref(o); 139 blame_origin_decref(o);
@@ -224,8 +225,7 @@ cleanup:
224} 225}
225 226
226static int walk_tree(const struct object_id *oid, struct strbuf *base, 227static int walk_tree(const struct object_id *oid, struct strbuf *base,
227 const char *pathname, unsigned mode, int stage, 228 const char *pathname, unsigned mode, void *cbdata)
228 void *cbdata)
229{ 229{
230 struct walk_tree_context *walk_tree_ctx = cbdata; 230 struct walk_tree_context *walk_tree_ctx = cbdata;
231 231
@@ -260,7 +260,7 @@ static int basedir_len(const char *path)
260 260
261void cgit_print_blame(void) 261void cgit_print_blame(void)
262{ 262{
263 const char *rev = ctx.qry.sha1; 263 const char *rev = ctx.qry.oid;
264 struct object_id oid; 264 struct object_id oid;
265 struct commit *commit; 265 struct commit *commit;
266 struct pathspec_item path_items = { 266 struct pathspec_item path_items = {
@@ -294,10 +294,8 @@ void cgit_print_blame(void)
294 walk_tree_ctx.match_baselen = (path_items.match) ? 294 walk_tree_ctx.match_baselen = (path_items.match) ?
295 basedir_len(path_items.match) : -1; 295 basedir_len(path_items.match) : -1;
296 296
297 read_tree_recursive(the_repository, 297 read_tree(the_repository, repo_get_commit_tree(the_repository, commit),
298 repo_get_commit_tree(the_repository, commit), 298 &paths, walk_tree, &walk_tree_ctx);
299 "", 0, 0,
300 &paths, walk_tree, &walk_tree_ctx);
301 if (!walk_tree_ctx.state) 299 if (!walk_tree_ctx.state)
302 cgit_print_error_page(404, "Not found", "Not found"); 300 cgit_print_error_page(404, "Not found", "Not found");
303 else if (walk_tree_ctx.state == 2) 301 else if (walk_tree_ctx.state == 2)