Merge branch 'js/mv-dir-to-new-directory'
[gitweb.git] / merge-recursive.c
index 9e527dec62a71940174a31a3a8040f2498ad6c73..e5243c2b766881b5b4c83a16d9caebbd392c798a 100644 (file)
@@ -436,7 +436,7 @@ static void record_df_conflict_files(struct merge_options *o,
         * and the file need to be present, then the D/F file will be
         * reinstated with a new unique name at the time it is processed.
         */
-       struct string_list df_sorted_entries;
+       struct string_list df_sorted_entries = STRING_LIST_INIT_NODUP;
        const char *last_file = NULL;
        int last_len = 0;
        int i;
@@ -449,7 +449,6 @@ static void record_df_conflict_files(struct merge_options *o,
                return;
 
        /* Ensure D/F conflicts are adjacent in the entries list. */
-       memset(&df_sorted_entries, 0, sizeof(struct string_list));
        for (i = 0; i < entries->nr; i++) {
                struct string_list_item *next = &entries->items[i];
                string_list_append(&df_sorted_entries, next->string)->util =
@@ -2069,8 +2068,10 @@ int merge_recursive(struct merge_options *o,
        o->ancestor = "merged common ancestors";
        clean = merge_trees(o, h1->tree, h2->tree, merged_common_ancestors->tree,
                            &mrtree);
-       if (clean < 0)
+       if (clean < 0) {
+               flush_output(o);
                return clean;
+       }
 
        if (o->call_depth) {
                *result = make_virtual_commit(mrtree, "merged tree");