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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Apr 25, 2012 at 22:35 UTC 2e7da8e9f436f58730c087144763d3e45b6572c4
1 file changed +2 -2
revision.c
+2 -2
@@ -2066,6 +2066,7 @@ int prepare_revision_walk(struct rev_info *revs)
2066 {
2067 int nr = revs->pending.nr;
2068 struct object_array_entry *e, *list;
2069 + struct commit_list **next = &revs->commits;
2070
2071 e = list = revs->pending.objects;
2072 revs->pending.nr = 0;
@@ -2076,12 +2077,11 @@ int prepare_revision_walk(struct rev_info *revs)
2077 if (commit) {
2078 if (!(commit->object.flags & SEEN)) {
2079 commit->object.flags |= SEEN;
2079 - commit_list_insert(commit, &revs->commits);
2080 + next = commit_list_append(commit, next);
2081 }
2082 }
2083 e++;
2084 }
2084 - commit_list_reverse(&revs->commits);
2085 commit_list_sort_by_date(&revs->commits);
2086 if (!revs->leak_pending)
2087 free(list);