Merge branch 'cb/maint-merge-recursive-submodule-fix'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 Apr 2009 05:32:56 +0000 (22:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Apr 2009 05:32:56 +0000 (22:32 -0700)
* cb/maint-merge-recursive-submodule-fix:
simplify output of conflicting merge
update cache for conflicting submodule entries
add tests for merging with submodules

1  2 
merge-recursive.c
diff --combined merge-recursive.c
index 3e1bc3e07f234089656397361b2b83b59bdc19a7,9bf5cc71754df1df29057822cf16bbfe51579d37..d6f0582238cac037a9779c905b7ece55b9d21ac1
@@@ -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)
                /* 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