[PATCH 2/4] revision traversal: retire BOUNDARY_SHOW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This removes the flag internally used by revision traversal to
decide which commits are indeed boundaries and renames it to
CHILD_SHOWN.  builtin-bundle uses the symbol for its
verification, but I think the logic it uses it is wrong.  The
flag is still useful but it is local to the git-bundle, so it is
renamed to PREREQ_MARK.

Signed-off-by: Junio C Hamano <junkio@xxxxxxx>
---
 * The earlier one that competed with Johannes's and Linus's is
   the [1/4] of this series.

 builtin-bundle.c |    6 ++++--
 revision.c       |    9 ++++++++-
 revision.h       |    3 +--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/builtin-bundle.c b/builtin-bundle.c
index d41a413..0265845 100644
--- a/builtin-bundle.c
+++ b/builtin-bundle.c
@@ -160,6 +160,8 @@ static int fork_with_pipe(const char **argv, int *in, int *out)
 	return pid;
 }
 
+#define PREREQ_MARK (1u<<16)
+
 static int verify_bundle(struct bundle_header *header)
 {
 	/*
@@ -179,7 +181,7 @@ static int verify_bundle(struct bundle_header *header)
 		struct ref_list_entry *e = p->list + i;
 		struct object *o = parse_object(e->sha1);
 		if (o) {
-			o->flags |= BOUNDARY_SHOW;
+			o->flags |= PREREQ_MARK;
 			add_pending_object(&revs, o, e->name);
 			continue;
 		}
@@ -202,7 +204,7 @@ static int verify_bundle(struct bundle_header *header)
 
 	i = req_nr;
 	while (i && (commit = get_revision(&revs)))
-		if (commit->object.flags & BOUNDARY_SHOW)
+		if (commit->object.flags & PREREQ_MARK)
 			i--;
 
 	for (i = 0; i < req_nr; i++)
diff --git a/revision.c b/revision.c
index 5d137ea..2d27ccf 100644
--- a/revision.c
+++ b/revision.c
@@ -1285,17 +1285,21 @@ struct commit *get_revision(struct rev_info *revs)
 			commit_list_insert(c, &l);
 		revs->commits = l;
 		revs->reverse = 0;
+		c = NULL;
 	}
 
 	/*
 	 * Now pick up what they want to give us
 	 */
-	c = get_revision_1(revs);
+	if (!(c = get_revision_1(revs)))
+		return NULL;
 	while (0 < revs->skip_count) {
 		revs->skip_count--;
 		c = get_revision_1(revs);
 		if (!c)
 			break;
+		/* Although we grabbed it, it is not shown. */
+		c->object.flags &= ~SHOWN;
 	}
 
 	/*
@@ -1305,6 +1309,9 @@ struct commit *get_revision(struct rev_info *revs)
 	case -1:
 		break;
 	case 0:
+		/* Although we grabbed it, it is not shown. */
+		if (c)
+			c->object.flags &= ~SHOWN;
 		c = NULL;
 		break;
 	default:
diff --git a/revision.h b/revision.h
index 6579a44..1885f8d 100644
--- a/revision.h
+++ b/revision.h
@@ -7,10 +7,9 @@
 #define SHOWN		(1u<<3)
 #define TMP_MARK	(1u<<4) /* for isolated cases; clean after use */
 #define BOUNDARY	(1u<<5)
-#define BOUNDARY_SHOW	(1u<<6)
+#define CHILD_SHOWN	(1u<<6)
 #define ADDED		(1u<<7)	/* Parents already parsed and added? */
 #define SYMMETRIC_LEFT	(1u<<8)
-#define CHILD_SHOWN	(1u<<9)
 
 struct rev_info;
 struct log_info;
-- 
1.5.0.3.862.g71037


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]