@matheusbsbs / matheus-bagliano / commits / f5184380f0
Fork 0

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 <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Alex Riesen committed Jan 4, 2007 at 11:22 UTC f5184380f08c814535e7bda374e403596eef90a3
1 file changed +2 -5
merge-recursive.c
+2 -5
@@ -954,8 +954,6 @@ static int process_renames(struct path_list *a_renames,
954 path_list_clear(&a_by_dst, 0);
955 path_list_clear(&b_by_dst, 0);
956
957 - if (cache_dirty)
958 - flush_cache();
957 return clean_merge;
958 }
959
@@ -1083,9 +1081,6 @@ static int process_entry(const char *path, struct stage_data *entry,
1081 } else
1082 die("Fatal merge failure, shouldn't happen.");
1083
1086 - if (cache_dirty)
1087 - flush_cache();
1088 -
1084 return clean_merge;
1085 }
1086
@@ -1133,6 +1128,8 @@ static int merge_trees(struct tree *head,
1128 if (!process_entry(path, e, branch1, branch2))
1129 clean = 0;
1130 }
1131 + if (cache_dirty)
1132 + flush_cache();
1133
1134 path_list_clear(re_merge, 0);
1135 path_list_clear(re_head, 0);