@matheusbsbs / matheus-bagliano / commits / df3a02f612
Fork 0

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>

Lars Hjemli committed Sep 25, 2007 at 08:36 UTC df3a02f6125f7ac82b6e81e3e32cd7ca3c7905ee
1 file changed +6
merge-recursive.c
+6
@@ -96,6 +96,7 @@ static struct path_list current_directory_set = {NULL, 0, 0, 1};
96
97 static int call_depth = 0;
98 static int verbosity = 2;
99 +static int rename_limit = -1;
100 static int buffer_output = 1;
101 static struct output_buffer *output_list, *output_end;
102
@@ -372,6 +373,7 @@ static struct path_list *get_renames(struct tree *tree,
373 diff_setup(&opts);
374 opts.recursive = 1;
375 opts.detect_rename = DIFF_DETECT_RENAME;
376 + opts.rename_limit = rename_limit;
377 opts.output_format = DIFF_FORMAT_NO_OUTPUT;
378 if (diff_setup_done(&opts) < 0)
379 die("diff setup failed");
@@ -1693,6 +1695,10 @@ static int merge_config(const char *var, const char *value)
1695 verbosity = git_config_int(var, value);
1696 return 0;
1697 }
1698 + if (!strcasecmp(var, "diff.renamelimit")) {
1699 + rename_limit = git_config_int(var, value);
1700 + return 0;
1701 + }
1702 return git_default_config(var, value);
1703 }
1704