Skip to content

Commit

Permalink
Speed-up recursive by flushing index only once for all entries
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Jan 10, 2007
1 parent 2a3a3c2 commit f518438
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions merge-recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,8 +954,6 @@ static int process_renames(struct path_list *a_renames,
path_list_clear(&a_by_dst, 0);
path_list_clear(&b_by_dst, 0);

if (cache_dirty)
flush_cache();
return clean_merge;
}

Expand Down Expand Up @@ -1083,9 +1081,6 @@ static int process_entry(const char *path, struct stage_data *entry,
} else
die("Fatal merge failure, shouldn't happen.");

if (cache_dirty)
flush_cache();

return clean_merge;
}

Expand Down Expand Up @@ -1133,6 +1128,8 @@ static int merge_trees(struct tree *head,
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);
Expand Down

0 comments on commit f518438

Please sign in to comment.