From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>,
Michael Mueller <mmueller@vigilantsw.com>,
Junio C Hamano <gitster@pobox.com>,
Ramkumar Ramachandra <artagnon@gmail.com>
Subject: [PATCH 2/3] revision: append to list instead of insert and reverse
Date: Wed, 25 Apr 2012 22:35:41 +0200 [thread overview]
Message-ID: <4F98601D.3070303@lsrfire.ath.cx> (raw)
In-Reply-To: <4F985D0A.9020100@lsrfire.ath.cx>
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>
---
revision.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/revision.c b/revision.c
index edb225d..9e63baa 100644
--- a/revision.c
+++ b/revision.c
@@ -2071,6 +2071,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;
@@ -2081,12 +2082,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);
--
1.7.10
next prev parent reply other threads:[~2012-04-25 20:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 7:59 Possible segfault introduced in commit.c Michael Mueller
2012-04-25 11:14 ` Jeff King
2012-04-25 20:22 ` René Scharfe
2012-04-25 20:35 ` [PATCH 1/3] sequencer: export commit_list_append() René Scharfe
2012-04-25 22:03 ` Junio C Hamano
2012-04-30 21:07 ` René Scharfe
2012-04-25 20:35 ` René Scharfe [this message]
2012-04-25 20:35 ` [PATCH 3/3] commit: remove commit_list_reverse() René Scharfe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F98601D.3070303@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mmueller@vigilantsw.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).