{"thread":{"id":"962","subject":"[PATCH 2/2] Fix for --merge-order, --max-age interaction issue","startedAt":"2005-06-16T22:26:17Z","lastAt":"2005-06-16T22:26:17Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"4997","messageId":"20050616222617.18233.qmail@blackcubes.dyndns.org","threadId":"962","inReplyTo":null,"subject":"[PATCH 2/2] Fix for --merge-order, --max-age interaction issue","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2005-06-16T22:26:17Z","receivedAt":"2005-06-16T22:26:17Z","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---\n\n rev-list.c |   14 +++++++++++---\n 1 files changed, 11 insertions(+), 3 deletions(-)\n\ndiff --git a/rev-list.c b/rev-list.c\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -24,6 +24,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@@ -53,15 +54,22 @@ 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)\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-\n \treturn DO;\n }\n \n------------\n"}]}