Anonymous committed f518438

Speed-up recursive by flushing index only once for all entries

The merge-recursive implementation in C inherited the invariant
that the on-file index file is written out and later read back
after any index operations and writing trees from the original
Python implementation. But it was only because the original
implementation worked at the scripting level.

There is no need to write out the index file after handling
every path.

Signed-off-by: Alex Riesen <>
Signed-off-by: Junio C Hamano <>

  • Participants
  • Parent commits 2a3a3c2

Comments (0)

Files changed (1)

File merge-recursive.c

 	path_list_clear(&a_by_dst, 0);
 	path_list_clear(&b_by_dst, 0);
-	if (cache_dirty)
-		flush_cache();
 	return clean_merge;
 	} else
 		die("Fatal merge failure, shouldn't happen.");
-	if (cache_dirty)
-		flush_cache();
 	return clean_merge;
 			if (!process_entry(path, e, branch1, branch2))
 				clean = 0;
+		if (cache_dirty)
+			flush_cache();
 		path_list_clear(re_merge, 0);
 		path_list_clear(re_head, 0);