Git development
 help / color / mirror / Atom feed
* [PATCH 5/7] Prevent git-rev-list --merge-order producing duplicates in the output
@ 2005-06-20  2:29 Jon Seymour
  0 siblings, 0 replies; only message in thread
From: Jon Seymour @ 2005-06-20  2:29 UTC (permalink / raw)
  To: git; +Cc: torvalds, jon.seymour, paulus


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>
---

 epoch.c |   35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/epoch.c b/epoch.c
--- a/epoch.c
+++ b/epoch.c
@@ -621,20 +621,27 @@ int sort_list_in_merge_order(struct comm
 			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;
+				}
 			}
 		}
 
------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-06-20  2:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-20  2:29 [PATCH 5/7] Prevent git-rev-list --merge-order producing duplicates in the output Jon Seymour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox