summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2012-04-25 22:35:41 +0200
committerJunio C Hamano <gitster@pobox.com>2012-04-25 14:51:19 -0700
commit2e7da8e9f436f58730c087144763d3e45b6572c4 (patch)
treee8dea4e3ceab6a15de725cc2404d8e3ffb55f869 /revision.c
parent89b5f1d9c5e64c9e232fa1ebe0ea407c8773b79a (diff)
downloadgit-2e7da8e9f436f58730c087144763d3e45b6572c4.tar.gz
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>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 92095f5fcb..c1934ba3ca 100644
--- a/revision.c
+++ b/revision.c
@@ -2066,6 +2066,7 @@ int prepare_revision_walk(struct rev_info *revs)
{
int nr = revs->pending.nr;
struct object_array_entry *e, *list;
+ struct commit_list **next = &revs->commits;
e = list = revs->pending.objects;
revs->pending.nr = 0;
@@ -2076,12 +2077,11 @@ int prepare_revision_walk(struct rev_info *revs)
if (commit) {
if (!(commit->object.flags & SEEN)) {
commit->object.flags |= SEEN;
- commit_list_insert(commit, &revs->commits);
+ next = commit_list_append(commit, next);
}
}
e++;
}
- commit_list_reverse(&revs->commits);
commit_list_sort_by_date(&revs->commits);
if (!revs->leak_pending)
free(list);