threads / patch / 1152

patchMove SEEN flag into epoch.h, replace use of VISITED flag with SEEN flag

Subject: [PATCH] Move SEEN flag into epoch.h, replace use of VISITED flag with SEEN flag

## tl;dr

One message between Jul 7, 2005 and Jul 7, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Jon Seymour· Jul 7, 2005, 02:11 UTC · lore
SEEN and VISITED do the same thing.

This change moves the SEEN flag into epoch.h, then replaces uses of VISITED with SEEN and removes the definition of the VISITED flag.

The merge-order code needs to clear the SEEN flag set by the argument parsing to ensure correct operation. So it clears that one and, for completeness, BOUNDARY and DISCONTINUITY too.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
 epoch.c    |   14 ++++++++------
 epoch.h    |    4 +---
 rev-list.c |    5 ++---
 3 files changed, 11 insertions(+), 12 deletions(-)
54a391ba7e4f96ce08ecb7da82941519b8a14c30
Show changes to 3 files +11 −12

epoch.c, epoch.h, rev-list.c

diff --git a/epoch.c b/epoch.c
--- a/epoch.c
+++ b/epoch.c
@@ -387,7 +387,7 @@ static void push_onto_merge_order_stack(
 static void mark_ancestors_uninteresting(struct commit *commit)
 {
 	unsigned int flags = commit->object.flags;
-	int visited = flags & VISITED;
+	int visited = flags & SEEN;
 	int boundary = flags & BOUNDARY;
 	int uninteresting = flags & UNINTERESTING;
 	struct commit_list *next;
@@ -425,7 +425,7 @@ static void sort_first_epoch(struct comm
 {
 	struct commit_list *parents;
 
-	head->object.flags |= VISITED;
+	head->object.flags |= SEEN;
 
 	/*
 	 * TODO: By sorting the parents in a different order, we can alter the
@@ -450,14 +450,14 @@ static void sort_first_epoch(struct comm
 			mark_ancestors_uninteresting(parent);
 		}
 
-		if (!(parent->object.flags & VISITED)) {
+		if (!(parent->object.flags & SEEN)) {
 			if (parent->object.flags & BOUNDARY) {
 				if (*stack) {
 					die("something else is on the stack - %s",
 					    sha1_to_hex((*stack)->item->object.sha1));
 				}
 				push_onto_merge_order_stack(stack, parent);
-				parent->object.flags |= VISITED;
+				parent->object.flags |= SEEN;
 
 			} else {
 				sort_first_epoch(parent, stack);
@@ -582,8 +582,10 @@ int sort_list_in_merge_order(struct comm
 	int action = CONTINUE;
 	struct commit_list *reversed = NULL;
 
-	for (; list; list = list->next)
+	for (; list; list = list->next) {
+		list->item->object.flags &= ~(SEEN|BOUNDARY|DISCONTINUITY);
 		commit_list_insert(list->item, &reversed);
+	}
 
 	if (!reversed)
 		return ret;
@@ -606,7 +608,7 @@ int sort_list_in_merge_order(struct comm
 		while (reversed) {
 			struct commit * next = pop_commit(&reversed);
 
-			if (!(next->object.flags & VISITED) && next!=base) {
+			if (!(next->object.flags & SEEN) && next!=base) {
 				sort_first_epoch(next, &stack);
 				if (reversed) {
 					/*
diff --git a/epoch.h b/epoch.h
--- a/epoch.h
+++ b/epoch.h
@@ -13,9 +13,7 @@ int sort_list_in_merge_order(struct comm
 /* Low bits are used by rev-list */
 #define UNINTERESTING   (1u<<10)
 #define BOUNDARY        (1u<<11)
-#define VISITED         (1u<<12)
+#define SEEN            (1u<<12)
 #define DISCONTINUITY   (1u<<13)
-#define LAST_EPOCH_FLAG (1u<<14)
-
 
 #endif	/* EPOCH_H */
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -5,9 +5,8 @@
 #include "blob.h"
 #include "epoch.h"
 
-#define SEEN		(1u << 0)
-#define INTERESTING	(1u << 1)
-#define COUNTED		(1u << 2)
+#define INTERESTING	(1u << 0)
+#define COUNTED		(1u << 1)
 
 static const char rev_list_usage[] =
 	"usage: git-rev-list [OPTION] commit-id <commit-id>\n"
------------

← back to recent threads