[PATCH] Prevent git-rev-list --merge-order producing duplicates in the output

If a is reachable from b, then git-rev-list --merge-order b a would
produce a duplicate output of b.

This causes a problem for an upcoming version of gitk since it
breaks the --merge-order ordering invariant.

This patch fixes the problem for the --merge-order switch. A subsequent
patch will fix the problem for the non --merge-order switch.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Jon Seymour 2005-06-20 12:29:36 +10:00 committed by Linus Torvalds
parent c3c1163137
commit eff19d5ecc

35
epoch.c
View File

@ -621,20 +621,27 @@ int sort_list_in_merge_order(struct commit_list *list, emitter_func emitter)
base->object.flags |= BOUNDARY; base->object.flags |= BOUNDARY;
while (reversed) { while (reversed) {
sort_first_epoch(pop_commit(&reversed), &stack); struct commit * next = pop_commit(&reversed);
if (reversed) {
/* if (!(next->object.flags & VISITED)) {
* If we have more commits to push, then the sort_first_epoch(next, &stack);
* first push for the next parent may (or may if (reversed) {
* not) represent a discontinuity with respect /*
* to the parent currently on the top of * If we have more commits
* the stack. * to push, then the first
* * push for the next parent may
* Mark it for checking here, and check it * (or may * not) represent a
* with the next push. See sort_first_epoch() * discontinuity with respect
* for more details. * to the parent currently on
*/ * the top of the stack.
stack->item->object.flags |= DISCONTINUITY; *
* Mark it for checking here,
* and check it with the next
* push. See sort_first_epoch()
* for more details.
*/
stack->item->object.flags |= DISCONTINUITY;
}
} }
} }