git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] revision.c: really honor --first-parent

From
LHLars Hjemli <hjemli@gmail.com>
Date
May 12, 2008, 15:12 UTC
Message-ID
<1210605156-22926-1-git-send-email-hjemli@gmail.com>
In-Reply-To
<1210547651-32510-1-git-send-email-hjemli@gmail.com>

In add_parents_to_list, if any parent of a revision had already been SEEN, the current code would continue with the next parent, skipping the test for --first-parent. This patch inverts the test for SEEN so that the test for --first-parent is always performed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
This is a slightly different approach which I think is less ugly.
 revision.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/revision.c b/revision.c
index 44d780b..2fc26b8 100644
--- a/revision.c
+++ b/revision.c
@@ -468,10 +468,10 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
 		if (parse_commit(p) < 0)
 			return -1;
 		p->object.flags |= left_flag;
-		if (p->object.flags & SEEN)
-			continue;
-		p->object.flags |= SEEN;
-		insert_by_date(p, list);
+		if (!(p->object.flags & SEEN)) {
+			p->object.flags |= SEEN;
+			insert_by_date(p, list);
+		}
 		if(revs->first_parent_only)
 			break;
 	}
-- 
1.5.5.1.148.g8ee22.dirty
Previous: Lars HjemliNext: Stephen R. van den Berg
Message 4 of 10 in “"git log --first-parent" shows parents that are not first”
  1. しらいしななこMay 11, 2008
  2. Junio C HamanoMay 11, 2008
  3. revision.c: really honor --first-parentLars Hjemli, May 11, 2008
  4. revision.c: really honor --first-parentLars Hjemli, May 12, 2008
  5. Stephen R. van den BergMay 13, 2008
  6. Lars HjemliMay 13, 2008
  7. Junio C HamanoMay 13, 2008
  8. Stephen R. van den BergMay 14, 2008
  9. Lars HjemliMay 14, 2008
  10. Stephen R. van den BergMay 14, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.