Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-04-19 20:58:02 +0300
committerJunio C Hamano <gitster@pobox.com>2018-04-20 04:44:15 +0300
commit3992ff0c4caf925373b61aa17ab507207bf7e645 (patch)
treee222daab27eb19b7b82e89ea72e440652ff34f23 /merge-recursive.c
parent9cfee25a823d972250409b5c8bdfd91d1cdf7edb (diff)
merge-recursive: make !o->detect_rename codepath more obvious
Previously, if !o->detect_rename then get_renames() would return an empty string_list, and then process_renames() would have nothing to iterate over. It seems more straightforward to simply avoid calling either function in that case. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index fc96653f63..5da60b9516 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1339,8 +1339,6 @@ static struct string_list *get_renames(struct merge_options *o,
struct diff_options opts;
renames = xcalloc(1, sizeof(struct string_list));
- if (!o->detect_rename)
- return renames;
diff_setup(&opts);
opts.flags.recursive = 1;
@@ -1658,6 +1656,12 @@ static int handle_renames(struct merge_options *o,
struct string_list *entries,
struct rename_info *ri)
{
+ ri->head_renames = NULL;
+ ri->merge_renames = NULL;
+
+ if (!o->detect_rename)
+ return 1;
+
ri->head_renames = get_renames(o, head, common, head, merge, entries);
ri->merge_renames = get_renames(o, merge, common, head, merge, entries);
return process_renames(o, ri->head_renames, ri->merge_renames);
@@ -1668,6 +1672,9 @@ static void cleanup_rename(struct string_list *rename)
const struct rename *re;
int i;
+ if (rename == NULL)
+ return;
+
for (i = 0; i < rename->nr; i++) {
re = rename->items[i].util;
diff_free_filepair(re->pair);