Skip to content

Commit 4243b2d

Browse files
committed
Merge branch 'vm/octopus-merge-bases-simplify'
* vm/octopus-merge-bases-simplify: get_octopus_merge_bases(): cleanup redundant variable
2 parents 2b28497 + 6bc7672 commit 4243b2d

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

commit.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -841,26 +841,26 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co
841841
struct commit_list *get_octopus_merge_bases(struct commit_list *in)
842842
{
843843
struct commit_list *i, *j, *k, *ret = NULL;
844-
struct commit_list **pptr = &ret;
845844

846-
for (i = in; i; i = i->next) {
847-
if (!ret)
848-
pptr = &commit_list_insert(i->item, pptr)->next;
849-
else {
850-
struct commit_list *new = NULL, *end = NULL;
851-
852-
for (j = ret; j; j = j->next) {
853-
struct commit_list *bases;
854-
bases = get_merge_bases(i->item, j->item, 1);
855-
if (!new)
856-
new = bases;
857-
else
858-
end->next = bases;
859-
for (k = bases; k; k = k->next)
860-
end = k;
861-
}
862-
ret = new;
845+
if (!in)
846+
return ret;
847+
848+
commit_list_insert(in->item, &ret);
849+
850+
for (i = in->next; i; i = i->next) {
851+
struct commit_list *new = NULL, *end = NULL;
852+
853+
for (j = ret; j; j = j->next) {
854+
struct commit_list *bases;
855+
bases = get_merge_bases(i->item, j->item, 1);
856+
if (!new)
857+
new = bases;
858+
else
859+
end->next = bases;
860+
for (k = bases; k; k = k->next)
861+
end = k;
863862
}
863+
ret = new;
864864
}
865865
return ret;
866866
}

0 commit comments

Comments
 (0)