{"thread":{"id":"985","subject":"[PATCH 5/7] Prevent git-rev-list --merge-order producing duplicates in the output","startedAt":"2005-06-20T02:29:36Z","lastAt":"2005-06-20T02:29:36Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"5061","messageId":"20050620022936.28620.qmail@blackcubes.dyndns.org","threadId":"985","inReplyTo":null,"subject":"[PATCH 5/7] Prevent git-rev-list --merge-order producing duplicates in the output","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2005-06-20T02:29:36Z","receivedAt":"2005-06-20T02:29:36Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"\nIf a is reachable from b, then git-rev-list --merge-order b a would\nproduce a duplicate output of b.\n\nThis causes a problem for an upcoming version of gitk since it\nbreaks the --merge-order ordering invariant.\n\nThis patch fixes the problem for the --merge-order switch. A subsequent\npatch will fix the problem for the non --merge-order switch.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n\n epoch.c |   35 +++++++++++++++++++++--------------\n 1 files changed, 21 insertions(+), 14 deletions(-)\n\ndiff --git a/epoch.c b/epoch.c\n--- a/epoch.c\n+++ b/epoch.c\n@@ -621,20 +621,27 @@ int sort_list_in_merge_order(struct comm\n \t\t\tbase->object.flags |= BOUNDARY;\n \n \t\twhile (reversed) {\n-\t\t\tsort_first_epoch(pop_commit(&reversed), &stack);\n-\t\t\tif (reversed) {\n-\t\t\t\t/*\n-\t\t\t\t * If we have more commits to push, then the\n-\t\t\t\t * first push for the next parent may (or may\n-\t\t\t\t * not) represent a discontinuity with respect\n-\t\t\t\t * to the parent currently on the top of\n-\t\t\t\t * the stack.\n-\t\t\t\t *\n-\t\t\t\t * Mark it for checking here, and check it\n-\t\t\t\t * with the next push. See sort_first_epoch()\n-\t\t\t\t * for more details.\n-\t\t\t\t */\n-\t\t\t\tstack->item->object.flags |= DISCONTINUITY;\n+\t\t\tstruct commit * next = pop_commit(&reversed);\n+\n+\t\t\tif (!(next->object.flags & VISITED)) {\n+\t\t\t\tsort_first_epoch(next, &stack);\n+\t\t\t\tif (reversed) {\n+\t\t\t\t\t/*\n+\t\t\t\t\t * If we have more commits \n+\t\t\t\t\t * to push, then the first\n+\t\t\t\t\t * push for the next parent may \n+\t\t\t\t\t * (or may * not) represent a \n+\t\t\t\t\t * discontinuity with respect\n+\t\t\t\t\t * to the parent currently on \n+\t\t\t\t\t * the top of the stack.\n+\t\t\t\t\t *\n+\t\t\t\t\t * Mark it for checking here, \n+\t\t\t\t\t * and check it with the next \n+\t\t\t\t\t * push. See sort_first_epoch()\n+\t\t\t\t\t * for more details.\n+\t\t\t\t\t */\n+\t\t\t\t\tstack->item->object.flags |= DISCONTINUITY;\n+\t\t\t\t}\n \t\t\t}\n \t\t}\n \n------------\n"}]}