Skip to content

Commit 17a07e2

Browse files
dakhubgitgitster
authored andcommitted
blame: require 0 context lines while finding moved lines with -M
The core part of git blame -M required 1 context line, but there is no rationale to be found in the code; it causes artifacts like discussed in the thread: <http://thread.gmane.org/gmane.comp.version-control.git/255289/>. <http://permalink.gmane.org/gmane.comp.version-control.git/295795> sheds some more light on the history of the previous choice. Signed-off-by: David Kastrup <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7777322 commit 17a07e2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

builtin/blame.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,14 @@ struct progress_info {
134134
int blamed_lines;
135135
};
136136

137-
static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
137+
static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b,
138138
xdl_emit_hunk_consume_func_t hunk_func, void *cb_data)
139139
{
140140
xpparam_t xpp = {0};
141141
xdemitconf_t xecfg = {0};
142142
xdemitcb_t ecb = {NULL};
143143

144144
xpp.flags = xdl_opts;
145-
xecfg.ctxlen = ctxlen;
146145
xecfg.hunk_func = hunk_func;
147146
ecb.priv = cb_data;
148147
return xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb);
@@ -980,7 +979,7 @@ static void pass_blame_to_parent(struct scoreboard *sb,
980979
fill_origin_blob(&sb->revs->diffopt, target, &file_o);
981980
num_get_patch++;
982981

983-
if (diff_hunks(&file_p, &file_o, 0, blame_chunk_cb, &d))
982+
if (diff_hunks(&file_p, &file_o, blame_chunk_cb, &d))
984983
die("unable to generate diff (%s -> %s)",
985984
oid_to_hex(&parent->commit->object.oid),
986985
oid_to_hex(&target->commit->object.oid));
@@ -1129,7 +1128,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
11291128
* file_p partially may match that image.
11301129
*/
11311130
memset(split, 0, sizeof(struct blame_entry [3]));
1132-
if (diff_hunks(file_p, &file_o, 1, handle_split_cb, &d))
1131+
if (diff_hunks(file_p, &file_o, handle_split_cb, &d))
11331132
die("unable to generate diff (%s)",
11341133
oid_to_hex(&parent->commit->object.oid));
11351134
/* remainder, if any, all match the preimage */

0 commit comments

Comments
 (0)