]> rtime.felk.cvut.cz Git - git.git/commitdiff
merge-recursive: do not return NULL only to cause segfault
authorJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2010 00:38:56 +0000 (16:38 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2010 01:02:30 +0000 (17:02 -0800)
merge-recursive calls write_tree_from_memory() to come up with a virtual
tree, with possible conflict markers inside the blob contents, while
merging multiple common ancestors down.  It is a bug to call the function
with unmerged entries in the index, even if the merge to come up with the
common ancestor resulted in conflicts.  Otherwise the result won't be
expressible as a tree object.

We _might_ want to suggest the user to set GIT_MERGE_VERBOSITY to 5 and
re-run the merge in the message.  At least we will know which part of
process_renames() or process_entry() functions is not correctly handling
the unmerged paths, and it might help us diagnosing the issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c

index dd4fbd0e6bc22f2e5f5667205b47165f8aebbbd0..22a31ed5ff5d1affd54da43769a3982ba2ec1b75 100644 (file)
@@ -200,14 +200,14 @@ struct tree *write_tree_from_memory(struct merge_options *o)
 
        if (unmerged_cache()) {
                int i;
-               output(o, 0, "There are unmerged index entries:");
+               fprintf(stderr, "BUG: There are unmerged index entries:\n");
                for (i = 0; i < active_nr; i++) {
                        struct cache_entry *ce = active_cache[i];
                        if (ce_stage(ce))
-                               output(o, 0, "%d %.*s", ce_stage(ce),
-                                      (int)ce_namelen(ce), ce->name);
+                               fprintf(stderr, "BUG: %d %.*s", ce_stage(ce),
+                                       (int)ce_namelen(ce), ce->name);
                }
-               return NULL;
+               die("Bug in merge-recursive.c");
        }
 
        if (!active_cache_tree)