{"thread":{"id":"1009","subject":"[PATCH 2/2] Fix to how --merge-order handles multiple roots","startedAt":"2005-06-23T02:01:12Z","lastAt":"2005-06-23T02:01:12Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"5146","messageId":"20050623020112.16423.qmail@blackcubes.dyndns.org","threadId":"1009","inReplyTo":null,"subject":"[PATCH 2/2] Fix to how --merge-order handles multiple roots","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2005-06-23T02:01:12Z","receivedAt":"2005-06-23T02:01:12Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"\nThis patch addresses the problem reported by Paul Mackerras such that --merge-order\ndid not report the last root of a graph with merge of two independent roots.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n\n epoch.c |   11 +++++++----\n 1 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/epoch.c b/epoch.c\n--- a/epoch.c\n+++ b/epoch.c\n@@ -488,7 +488,7 @@ static void sort_first_epoch(struct comm\n  *\n  * Sets the return value to STOP if no further output should be generated.\n  */\n-static int emit_stack(struct commit_list **stack, emitter_func emitter)\n+static int emit_stack(struct commit_list **stack, emitter_func emitter, int include_last)\n {\n \tunsigned int seen = 0;\n \tint action = CONTINUE;\n@@ -496,8 +496,11 @@ static int emit_stack(struct commit_list\n \twhile (*stack && (action != STOP)) {\n \t\tstruct commit *next = pop_commit(stack);\n \t\tseen |= next->object.flags;\n-\t\tif (*stack)\n+\t\tif (*stack || include_last) {\n+\t\t\tif (!*stack) \n+\t\t\t\tnext->object.flags |= BOUNDARY;\n \t\t\taction = (*emitter) (next);\n+\t\t}\n \t}\n \n \tif (*stack) {\n@@ -553,7 +556,7 @@ static int sort_in_merge_order(struct co\n \t\t} else {\n \t\t\tstruct commit_list *stack = NULL;\n \t\t\tsort_first_epoch(next, &stack);\n-\t\t\taction = emit_stack(&stack, emitter);\n+\t\t\taction = emit_stack(&stack, emitter, (base == NULL));\n \t\t\tnext = base;\n \t\t}\n \t}\n@@ -636,7 +639,7 @@ int sort_list_in_merge_order(struct comm\n \t\t\t}\n \t\t}\n \n-\t\taction = emit_stack(&stack, emitter);\n+\t\taction = emit_stack(&stack, emitter, (base==NULL));\n \t}\n \n \tif (base && (action != STOP)) {\n------------\n"}]}