Skip to content

Commit 683a820

Browse files
committed
Merge branch 'jc/merge-bases-paint-fix'
"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
2 parents 5a333ad + d866924 commit 683a820

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

commit.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ static struct commit *interesting(struct commit_list *list)
609609
return NULL;
610610
}
611611

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

618619
one->object.flags |= PARENT1;
619620
commit_list_insert_by_date(one, &list);
621+
if (!n)
622+
return list;
620623
for (i = 0; i < n; i++) {
621624
twos[i]->object.flags |= PARENT2;
622625
commit_list_insert_by_date(twos[i], &list);
@@ -737,6 +740,8 @@ static int remove_redundant(struct commit **array, int cnt)
737740
redundant = xcalloc(cnt, 1);
738741
filled_index = xmalloc(sizeof(*filled_index) * (cnt - 1));
739742

743+
for (i = 0; i < cnt; i++)
744+
parse_commit(array[i]);
740745
for (i = 0; i < cnt; i++) {
741746
struct commit_list *common;
742747

0 commit comments

Comments
 (0)