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 <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Philippe Blain committed
Nov 1, 2020 at 17:28 UTC
88894aaeeae92e8cb41143cc2e045f50289dc790
3 files changed
+6
-8
blame.c
+5
-6
@@ -2764,7 +2764,6 @@ void init_scoreboard(struct blame_scoreboard *sb)
2764
}
2765
2766
void setup_scoreboard(struct blame_scoreboard *sb,
2767
- const char *path,
2767
struct blame_origin **orig)
2768
{
2769
const char *final_commit_name = NULL;
@@ -2803,7 +2802,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
2802
setup_work_tree();
2803
sb->final = fake_working_tree_commit(sb->repo,
2804
&sb->revs->diffopt,
2806
- path, sb->contents_from);
2805
+ sb->path, sb->contents_from);
2806
add_pending_object(sb->revs, &(sb->final->object), ":");
2807
}
2808
@@ -2846,12 +2845,12 @@ void setup_scoreboard(struct blame_scoreboard *sb,
2845
sb->final_buf_size = o->file.size;
2846
}
2847
else {
2849
- o = get_origin(sb->final, path);
2848
+ o = get_origin(sb->final, sb->path);
2849
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);
2851
2852
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,
2854
&sb->final_buf_size))
2855
;
2856
else
@@ -2861,7 +2860,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
2860
if (!sb->final_buf)
2861
die(_("cannot read blob %s for path %s"),
2862
oid_to_hex(&o->blob_oid),
2864
- path);
2863
+ sb->path);
2864
}
2865
sb->num_read_blob++;
2866
prepare_lines(sb);
blame.h
-1
@@ -181,7 +181,6 @@ const char *blame_nth_line(struct blame_scoreboard *sb, long lno);
181
182
void init_scoreboard(struct blame_scoreboard *sb);
183
void setup_scoreboard(struct blame_scoreboard *sb,
184
- const char *path,
184
struct blame_origin **orig);
185
void setup_blame_bloom_data(struct blame_scoreboard *sb,
186
const char *path);
builtin/blame.c
+1
-1
@@ -1087,7 +1087,7 @@ parse_done:
1087
build_ignorelist(&sb, &ignore_revs_file_list, &ignore_rev_list);
1088
string_list_clear(&ignore_revs_file_list, 0);
1089
string_list_clear(&ignore_rev_list, 0);
1090
- setup_scoreboard(&sb, path, &o);
1090
+ setup_scoreboard(&sb, &o);
1091
1092
/*
1093
* Changed-path Bloom filters are disabled when looking