Skip to content

Commit df3a02f

Browse files
hjemligitster
authored andcommitted
Make merge-recursive honor diff.renamelimit
It might be a sign of source code management gone bad, but when two branches has diverged almost beyond recognition and time has come for the branches to merge, the user is going to need all the help his tool can give him. Honoring diff.renamelimit has great potential as a painkiller in such situations. The painkiller effect could have been achieved by e.g. 'merge.renamelimit', but the flexibility gained by a separate option is questionable: our user would probably expect git to detect renames equally good when merging as when diffing (I known I did). Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2ecb5ea commit df3a02f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

merge-recursive.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static struct path_list current_directory_set = {NULL, 0, 0, 1};
9696

9797
static int call_depth = 0;
9898
static int verbosity = 2;
99+
static int rename_limit = -1;
99100
static int buffer_output = 1;
100101
static struct output_buffer *output_list, *output_end;
101102

@@ -372,6 +373,7 @@ static struct path_list *get_renames(struct tree *tree,
372373
diff_setup(&opts);
373374
opts.recursive = 1;
374375
opts.detect_rename = DIFF_DETECT_RENAME;
376+
opts.rename_limit = rename_limit;
375377
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
376378
if (diff_setup_done(&opts) < 0)
377379
die("diff setup failed");
@@ -1693,6 +1695,10 @@ static int merge_config(const char *var, const char *value)
16931695
verbosity = git_config_int(var, value);
16941696
return 0;
16951697
}
1698+
if (!strcasecmp(var, "diff.renamelimit")) {
1699+
rename_limit = git_config_int(var, value);
1700+
return 0;
1701+
}
16961702
return git_default_config(var, value);
16971703
}
16981704

0 commit comments

Comments
 (0)