Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 2e7da8e

Browse files
René Scharfegitster
authored andcommitted
revision: append to list instead of insert and reverse
By using commit_list_insert(), we added new items to the top of the list and, since this is not the order we want, reversed it afterwards. Simplify this process by adding new items at the bottom instead, getting rid of the reversal step. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 89b5f1d commit 2e7da8e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

revision.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,7 @@ int prepare_revision_walk(struct rev_info *revs)
20662066
{
20672067
int nr = revs->pending.nr;
20682068
struct object_array_entry *e, *list;
2069+
struct commit_list **next = &revs->commits;
20692070

20702071
e = list = revs->pending.objects;
20712072
revs->pending.nr = 0;
@@ -2076,12 +2077,11 @@ int prepare_revision_walk(struct rev_info *revs)
20762077
if (commit) {
20772078
if (!(commit->object.flags & SEEN)) {
20782079
commit->object.flags |= SEEN;
2079-
commit_list_insert(commit, &revs->commits);
2080+
next = commit_list_append(commit, next);
20802081
}
20812082
}
20822083
e++;
20832084
}
2084-
commit_list_reverse(&revs->commits);
20852085
commit_list_sort_by_date(&revs->commits);
20862086
if (!revs->leak_pending)
20872087
free(list);

0 commit comments

Comments
 (0)