{"thread":{"id":"986","subject":"[PATCH 6/7] Prevent git-rev-list without --merge-order producing duplicates in output","startedAt":"2005-06-20T02:29:38Z","lastAt":"2005-06-20T02:29:38Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"5062","messageId":"20050620022938.28641.qmail@blackcubes.dyndns.org","threadId":"986","inReplyTo":null,"subject":"[PATCH 6/7] Prevent git-rev-list without --merge-order producing duplicates in output","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2005-06-20T02:29:38Z","receivedAt":"2005-06-20T02:29:38Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"\nIf b is reachable from a, then:\n\n\t git-rev-list a b\n\nargument would print one of the commits twice.\n\nThis patch fixes that problem. A previous problem fixed it for the\n--merge-order switch.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n\n epoch.h    |   13 +++++++------\n rev-list.c |    5 +++--\n 2 files changed, 10 insertions(+), 8 deletions(-)\n\ndiff --git a/epoch.h b/epoch.h\n--- a/epoch.h\n+++ b/epoch.h\n@@ -10,11 +10,12 @@ typedef int (*emitter_func) (struct comm\n \n int sort_list_in_merge_order(struct commit_list *list, emitter_func emitter);\n \n-#define UNINTERESTING  (1u<<2)\n-#define BOUNDARY       (1u<<3)\n-#define VISITED        (1u<<4)\n-#define DISCONTINUITY  (1u<<5)\n-#define DUPCHECK       (1u<<6)\n+#define UNINTERESTING   (1u<<2)\n+#define BOUNDARY        (1u<<3)\n+#define VISITED         (1u<<4)\n+#define DISCONTINUITY   (1u<<5)\n+#define DUPCHECK        (1u<<6)\n+#define LAST_EPOCH_FLAG (1u<<6)\n \n \n-#endif\t\t\t\t/* EPOCH_H */\n+#endif\t/* EPOCH_H */\ndiff --git a/rev-list.c b/rev-list.c\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -5,6 +5,7 @@\n #define SEEN\t\t(1u << 0)\n #define INTERESTING\t(1u << 1)\n #define COUNTED\t\t(1u << 2)\n+#define SHOWN\t\t(LAST_EPOCH_FLAG << 2)\n \n static const char rev_list_usage[] =\n \t\"usage: git-rev-list [OPTION] commit-id <commit-id>\\n\"\n@@ -29,6 +30,7 @@ static int show_breaks = 0;\n \n static void show_commit(struct commit *commit)\n {\n+\tcommit->object.flags |= SHOWN;\n \tif (show_breaks) {\n \t\tprefix = \"| \";\n \t\tif (commit->object.flags & DISCONTINUITY) {\n@@ -55,7 +57,7 @@ static void show_commit(struct commit *c\n \n static int filter_commit(struct commit * commit)\n {\n-\tif (commit->object.flags & UNINTERESTING)\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@@ -63,7 +65,6 @@ static int filter_commit(struct commit *\n \t\treturn STOP;\n \tif (max_count != -1 && !max_count--)\n \t\treturn STOP;\n-\n \treturn DO;\n }\n \n------------\n"}]}