{"thread":{"id":"987","subject":"[PATCH 7/7] Fix for --merge-order, --max-age interaction issue","startedAt":"2005-06-20T02:29:41Z","lastAt":"2005-06-20T02:29:41Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"5063","messageId":"20050620022941.28662.qmail@blackcubes.dyndns.org","threadId":"987","inReplyTo":null,"subject":"[PATCH 7/7] Fix for --merge-order, --max-age interaction issue","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2005-06-20T02:29:41Z","receivedAt":"2005-06-20T02:29:41Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"\nThis patch fixes a problem reported by Paul Mackerras regarding the interaction\nof the --merge-order and --max-age switches of git-rev-list.\n\nThis patch applies to the current Linus HEAD. A cleaner fix for the same problem\nin my current HEAD will follow later.\n\nWith this change, --merge-order produces the same result as no --merge-order\non the linux-2.6 git repository, to wit:\n\n$> git-rev-list --max-age=1116330140 bcfff0b471a60df350338bcd727fc9b8a6aa54b2 | wc -l\n655\n$> git-rev-list --merge-order --max-age=1116330140 bcfff0b471a60df350338bcd727fc9b8a6aa54b2 | wc -l\n655\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n\n rev-list.c |   13 +++++++++++--\n 1 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/rev-list.c b/rev-list.c\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -27,6 +27,7 @@ static int max_count = -1;\n static enum cmit_fmt commit_format = CMIT_FMT_RAW;\n static int merge_order = 0;\n static int show_breaks = 0;\n+static int stop_traversal = 0;\n \n static void show_commit(struct commit *commit)\n {\n@@ -57,12 +58,20 @@ static void show_commit(struct commit *c\n \n static int filter_commit(struct commit * commit)\n {\n+\tif (merge_order && stop_traversal && commit->object.flags & BOUNDARY)\n+\t\treturn STOP;\n \tif (commit->object.flags & (UNINTERESTING|SHOWN))\n \t\treturn CONTINUE;\n \tif (min_age != -1 && (commit->date > min_age))\n \t\treturn CONTINUE;\n-\tif (max_age != -1 && (commit->date < max_age))\n-\t\treturn STOP;\n+\tif (max_age != -1 && (commit->date < max_age)) {\n+\t\tif (!merge_order)\n+\t\t\treturn STOP;\n+\t\telse {\n+\t\t\tstop_traversal = 1;\n+\t\t\treturn CONTINUE;\n+\t\t}\n+\t}\n \tif (max_count != -1 && !max_count--)\n \t\treturn STOP;\n \treturn DO;\n------------\n"}]}