From: Junio C Hamano Date: Wed, 8 Apr 2009 05:32:56 +0000 (-0700) Subject: Merge branch 'cb/maint-merge-recursive-submodule-fix' X-Git-Tag: v1.6.3-rc0~25 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2149e0f6a66cb4a5707ef6201763051d94f288af?ds=inline;hp=-c Merge branch 'cb/maint-merge-recursive-submodule-fix' * cb/maint-merge-recursive-submodule-fix: simplify output of conflicting merge update cache for conflicting submodule entries add tests for merging with submodules --- 2149e0f6a66cb4a5707ef6201763051d94f288af diff --combined merge-recursive.c index 3e1bc3e07f,9bf5cc7175..d6f0582238 --- a/merge-recursive.c +++ b/merge-recursive.c @@@ -801,19 -801,22 +801,19 @@@ static int process_renames(struct merge } for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) { - int compare; char *src; - struct string_list *renames1, *renames2, *renames2Dst; + struct string_list *renames1, *renames2Dst; struct rename *ren1 = NULL, *ren2 = NULL; const char *branch1, *branch2; const char *ren1_src, *ren1_dst; if (i >= a_renames->nr) { - compare = 1; ren2 = b_renames->items[j++].util; } else if (j >= b_renames->nr) { - compare = -1; ren1 = a_renames->items[i++].util; } else { - compare = strcmp(a_renames->items[i].string, - b_renames->items[j].string); + int compare = strcmp(a_renames->items[i].string, + b_renames->items[j].string); if (compare <= 0) ren1 = a_renames->items[i++].util; if (compare >= 0) @@@ -823,12 -826,14 +823,12 @@@ /* TODO: refactor, so that 1/2 are not needed */ if (ren1) { renames1 = a_renames; - renames2 = b_renames; renames2Dst = &b_by_dst; branch1 = o->branch1; branch2 = o->branch2; } else { struct rename *tmp; renames1 = b_renames; - renames2 = a_renames; renames2Dst = &a_by_dst; branch1 = o->branch2; branch2 = o->branch1; @@@ -1116,21 -1121,13 +1116,13 @@@ static int process_entry(struct merge_o o->branch1, o->branch2); clean_merge = mfi.clean; - if (mfi.clean) - update_file(o, 1, mfi.sha, mfi.mode, path); - else if (S_ISGITLINK(mfi.mode)) - output(o, 1, "CONFLICT (submodule): Merge conflict in %s " - "- needs %s", path, sha1_to_hex(b.sha1)); - else { + if (!mfi.clean) { + if (S_ISGITLINK(mfi.mode)) + reason = "submodule"; output(o, 1, "CONFLICT (%s): Merge conflict in %s", reason, path); - - if (o->call_depth) - update_file(o, 0, mfi.sha, mfi.mode, path); - else - update_file_flags(o, mfi.sha, mfi.mode, path, - 0 /* update_cache */, 1 /* update_working_directory */); } + update_file(o, mfi.clean, mfi.sha, mfi.mode, path); } else if (!o_sha && !a_sha && !b_sha) { /* * this entry was deleted altogether. a_mode == 0 means