@matheusbsbs / matheus-bagliano / commits / 2b064697a5
Fork 0

revision traversal: retire BOUNDARY_SHOW

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@cox.net>

Junio C Hamano committed Mar 5, 2007 at 16:10 UTC 2b064697a5b0610254f52523ce5b70c81118da80
3 files changed +13 -5
builtin-bundle.c
+4 -2
@@ -160,6 +160,8 @@ static int fork_with_pipe(const char **argv, int *in, int *out)
160 return pid;
161 }
162
163 +#define PREREQ_MARK (1u<<16)
164 +
165 static int verify_bundle(struct bundle_header *header)
166 {
167 /*
@@ -179,7 +181,7 @@ static int verify_bundle(struct bundle_header *header)
181 struct ref_list_entry *e = p->list + i;
182 struct object *o = parse_object(e->sha1);
183 if (o) {
182 - o->flags |= BOUNDARY_SHOW;
184 + o->flags |= PREREQ_MARK;
185 add_pending_object(&revs, o, e->name);
186 continue;
187 }
@@ -202,7 +204,7 @@ static int verify_bundle(struct bundle_header *header)
204
205 i = req_nr;
206 while (i && (commit = get_revision(&revs)))
205 - if (commit->object.flags & BOUNDARY_SHOW)
207 + if (commit->object.flags & PREREQ_MARK)
208 i--;
209
210 for (i = 0; i < req_nr; i++)
revision.c
+8 -1
@@ -1285,17 +1285,21 @@ struct commit *get_revision(struct rev_info *revs)
1285 commit_list_insert(c, &l);
1286 revs->commits = l;
1287 revs->reverse = 0;
1288 + c = NULL;
1289 }
1290
1291 /*
1292 * Now pick up what they want to give us
1293 */
1293 - c = get_revision_1(revs);
1294 + if (!(c = get_revision_1(revs)))
1295 + return NULL;
1296 while (0 < revs->skip_count) {
1297 revs->skip_count--;
1298 c = get_revision_1(revs);
1299 if (!c)
1300 break;
1301 + /* Although we grabbed it, it is not shown. */
1302 + c->object.flags &= ~SHOWN;
1303 }
1304
1305 /*
@@ -1305,6 +1309,9 @@ struct commit *get_revision(struct rev_info *revs)
1309 case -1:
1310 break;
1311 case 0:
1312 + /* Although we grabbed it, it is not shown. */
1313 + if (c)
1314 + c->object.flags &= ~SHOWN;
1315 c = NULL;
1316 break;
1317 default:
revision.h
+1 -2
@@ -7,10 +7,9 @@
7 #define SHOWN (1u<<3)
8 #define TMP_MARK (1u<<4) /* for isolated cases; clean after use */
9 #define BOUNDARY (1u<<5)
10 -#define BOUNDARY_SHOW (1u<<6)
10 +#define CHILD_SHOWN (1u<<6)
11 #define ADDED (1u<<7) /* Parents already parsed and added? */
12 #define SYMMETRIC_LEFT (1u<<8)
13 -#define CHILD_SHOWN (1u<<9)
13
14 struct rev_info;
15 struct log_info;