Skip to content

Commit 88894aa

Browse files
phil-blaingitster
authored andcommitted
blame: simplify 'setup_scoreboard' interface
The previous commit moved the initialization of 'sb.path' in 'builtin/blame.c::cmd_blame' before the call to 'blame.c::setup_scoreboard'. Since 'cmd_blame' is the only caller of 'setup_scoreboard', it is now unnecessary for 'setup_scoreboard' to receive 'path' as a separate argument, as 'sb.path' is already initialized. Remove this argument from setup_scoreboard's interface and use the 'path' field of the 'sb' 'struct blame_scoreboard' instead. Signed-off-by: Philippe Blain <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9466e38 commit 88894aa

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

blame.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,6 @@ void init_scoreboard(struct blame_scoreboard *sb)
27642764
}
27652765

27662766
void setup_scoreboard(struct blame_scoreboard *sb,
2767-
const char *path,
27682767
struct blame_origin **orig)
27692768
{
27702769
const char *final_commit_name = NULL;
@@ -2803,7 +2802,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
28032802
setup_work_tree();
28042803
sb->final = fake_working_tree_commit(sb->repo,
28052804
&sb->revs->diffopt,
2806-
path, sb->contents_from);
2805+
sb->path, sb->contents_from);
28072806
add_pending_object(sb->revs, &(sb->final->object), ":");
28082807
}
28092808

@@ -2846,12 +2845,12 @@ void setup_scoreboard(struct blame_scoreboard *sb,
28462845
sb->final_buf_size = o->file.size;
28472846
}
28482847
else {
2849-
o = get_origin(sb->final, path);
2848+
o = get_origin(sb->final, sb->path);
28502849
if (fill_blob_sha1_and_mode(sb->repo, o))
2851-
die(_("no such path %s in %s"), path, final_commit_name);
2850+
die(_("no such path %s in %s"), sb->path, final_commit_name);
28522851

28532852
if (sb->revs->diffopt.flags.allow_textconv &&
2854-
textconv_object(sb->repo, path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
2853+
textconv_object(sb->repo, sb->path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
28552854
&sb->final_buf_size))
28562855
;
28572856
else
@@ -2861,7 +2860,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
28612860
if (!sb->final_buf)
28622861
die(_("cannot read blob %s for path %s"),
28632862
oid_to_hex(&o->blob_oid),
2864-
path);
2863+
sb->path);
28652864
}
28662865
sb->num_read_blob++;
28672866
prepare_lines(sb);

blame.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ const char *blame_nth_line(struct blame_scoreboard *sb, long lno);
181181

182182
void init_scoreboard(struct blame_scoreboard *sb);
183183
void setup_scoreboard(struct blame_scoreboard *sb,
184-
const char *path,
185184
struct blame_origin **orig);
186185
void setup_blame_bloom_data(struct blame_scoreboard *sb,
187186
const char *path);

builtin/blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
10871087
build_ignorelist(&sb, &ignore_revs_file_list, &ignore_rev_list);
10881088
string_list_clear(&ignore_revs_file_list, 0);
10891089
string_list_clear(&ignore_rev_list, 0);
1090-
setup_scoreboard(&sb, path, &o);
1090+
setup_scoreboard(&sb, &o);
10911091

10921092
/*
10931093
* Changed-path Bloom filters are disabled when looking

0 commit comments

Comments
 (0)