aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Seymour <jon.seymour@gmail.com>2005-06-20 12:29:36 +1000
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-19 20:13:18 -0700
commiteff19d5eccd02341a25f1543ff89fa7351163e3f (patch)
tree6c8c5672eabf7e4d3455a5604c37e988ca0e7cc2
parentc3c1163137b0b1bbe1edf9da0421832e452c7a10 (diff)
downloadgit-eff19d5eccd02341a25f1543ff89fa7351163e3f.tar.gz
git-eff19d5eccd02341a25f1543ff89fa7351163e3f.tar.xz
[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>
-rw-r--r--epoch.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/epoch.c b/epoch.c
index fdfaddafb..35756a37e 100644
--- a/epoch.c
+++ b/epoch.c
@@ -621,20 +621,27 @@ int sort_list_in_merge_order(struct commit_list *list, emitter_func emitter)
base->object.flags |= BOUNDARY;
while (reversed) {
- sort_first_epoch(pop_commit(&reversed), &stack);
- if (reversed) {
- /*
- * If we have more commits to push, then the
- * first push for the next parent may (or may
- * not) represent a discontinuity with respect
- * to the parent currently on the top of
- * the stack.
- *
- * Mark it for checking here, and check it
- * with the next push. See sort_first_epoch()
- * for more details.
- */
- stack->item->object.flags |= DISCONTINUITY;
+ struct commit * next = pop_commit(&reversed);
+
+ if (!(next->object.flags & VISITED)) {
+ sort_first_epoch(next, &stack);
+ if (reversed) {
+ /*
+ * If we have more commits
+ * to push, then the first
+ * push for the next parent may
+ * (or may * not) represent a
+ * discontinuity with respect
+ * to the parent currently on
+ * the top of the stack.
+ *
+ * Mark it for checking here,
+ * and check it with the next
+ * push. See sort_first_epoch()
+ * for more details.
+ */
+ stack->item->object.flags |= DISCONTINUITY;
+ }
}
}