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

[PATCH 7/7] Fix for --merge-order, --max-age interaction issue

From
Jon Seymour <jon.seymour@gmail.com>
Date
Jun 20, 2005, 02:29 UTC
Message-ID
<20050620022941.28662.qmail@blackcubes.dyndns.org>

This patch fixes a problem reported by Paul Mackerras regarding the interaction of the --merge-order and --max-age switches of git-rev-list.

This patch applies to the current Linus HEAD. A cleaner fix for the same problem in my current HEAD will follow later.

With this change, --merge-order produces the same result as no --merge-order on the linux-2.6 git repository, to wit:

$> git-rev-list --max-age=1116330140 bcfff0b471a60df350338bcd727fc9b8a6aa54b2 | wc -l 655 $> git-rev-list --merge-order --max-age=1116330140 bcfff0b471a60df350338bcd727fc9b8a6aa54b2 | wc -l 655

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
 rev-list.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -27,6 +27,7 @@ static int max_count = -1;
 static enum cmit_fmt commit_format = CMIT_FMT_RAW;
 static int merge_order = 0;
 static int show_breaks = 0;
+static int stop_traversal = 0;
 
 static void show_commit(struct commit *commit)
 {
@@ -57,12 +58,20 @@ static void show_commit(struct commit *c
 
 static int filter_commit(struct commit * commit)
 {
+	if (merge_order && stop_traversal && commit->object.flags & BOUNDARY)
+		return STOP;
 	if (commit->object.flags & (UNINTERESTING|SHOWN))
 		return CONTINUE;
 	if (min_age != -1 && (commit->date > min_age))
 		return CONTINUE;
-	if (max_age != -1 && (commit->date < max_age))
-		return STOP;
+	if (max_age != -1 && (commit->date < max_age)) {
+		if (!merge_order)
+			return STOP;
+		else {
+			stop_traversal = 1;
+			return CONTINUE;
+		}
+	}
 	if (max_count != -1 && !max_count--)
 		return STOP;
 	return DO;
------------
Message 1 of 1 in “Fix for --merge-order, --max-age interaction issue”
  1. 7/7 Fix for --merge-order, --max-age interaction issueJon Seymour, Jun 20, 2005

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.