git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Simplify and fix --first-parent implementation
@ 2008-04-25 18:10 Stephen R. van den Berg
  2008-04-26  0:11 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen R. van den Berg @ 2008-04-25 18:10 UTC (permalink / raw)
  To: git

---
 revision.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/revision.c b/revision.c
index 4231ea2..bcfcd2a 100644
--- a/revision.c
+++ b/revision.c
@@ -415,7 +415,6 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
 {
 	struct commit_list *parent = commit->parents;
 	unsigned left_flag;
-	int add, rest;
 
 	if (commit->object.flags & ADDED)
 		return 0;
@@ -462,19 +461,18 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
 
 	left_flag = (commit->object.flags & SYMMETRIC_LEFT);
 
-	rest = !revs->first_parent_only;
-	for (parent = commit->parents, add = 1; parent; add = rest) {
+	for (parent = commit->parents; parent; parent = parent->next) {
 		struct commit *p = parent->item;
 
-		parent = parent->next;
 		if (parse_commit(p) < 0)
 			return -1;
 		p->object.flags |= left_flag;
 		if (p->object.flags & SEEN)
 			continue;
 		p->object.flags |= SEEN;
-		if (add)
-			insert_by_date(p, list);
+		insert_by_date(p, list);
+		if(revs->first_parent_only)
+			break;
 	}
 	return 0;
 }
-- 
1.5.5.1.83.ge77a4.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-26 19:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-25 18:10 [PATCH] Simplify and fix --first-parent implementation Stephen R. van den Berg
2008-04-26  0:11 ` Junio C Hamano
2008-04-26 11:59   ` Stephen R. van den Berg
2008-04-26 12:27     ` Jeff King
2008-04-26 19:13     ` Junio C Hamano

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).