Skip to content

Commit

Permalink
Merge branch 'jc/merge-bases-paint-fix'
Browse files Browse the repository at this point in the history
"git fmt-merge-msg" (an internal helper reduce_heads() it uses) had
a severe performance regression; an empty "git pull" took forever to
finish as the result.

* jc/merge-bases-paint-fix:
  paint_down_to_common(): parse commit before relying on its timestamp
  • Loading branch information
gitster committed Oct 8, 2012
2 parents 5a333ad + d866924 commit 683a820
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ static struct commit *interesting(struct commit_list *list)
return NULL;
}

/* all input commits in one and twos[] must have been parsed! */
static struct commit_list *paint_down_to_common(struct commit *one, int n, struct commit **twos)
{
struct commit_list *list = NULL;
Expand All @@ -617,6 +618,8 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n, struc

one->object.flags |= PARENT1;
commit_list_insert_by_date(one, &list);
if (!n)
return list;
for (i = 0; i < n; i++) {
twos[i]->object.flags |= PARENT2;
commit_list_insert_by_date(twos[i], &list);
Expand Down Expand Up @@ -737,6 +740,8 @@ static int remove_redundant(struct commit **array, int cnt)
redundant = xcalloc(cnt, 1);
filled_index = xmalloc(sizeof(*filled_index) * (cnt - 1));

for (i = 0; i < cnt; i++)
parse_commit(array[i]);
for (i = 0; i < cnt; i++) {
struct commit_list *common;

Expand Down

0 comments on commit 683a820

Please sign in to comment.