Skip to content

Commit 2b06469

Browse files
author
Junio C Hamano
committed
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 <[email protected]>
1 parent 86ab490 commit 2b06469

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

builtin-bundle.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ static int fork_with_pipe(const char **argv, int *in, int *out)
160160
return pid;
161161
}
162162

163+
#define PREREQ_MARK (1u<<16)
164+
163165
static int verify_bundle(struct bundle_header *header)
164166
{
165167
/*
@@ -179,7 +181,7 @@ static int verify_bundle(struct bundle_header *header)
179181
struct ref_list_entry *e = p->list + i;
180182
struct object *o = parse_object(e->sha1);
181183
if (o) {
182-
o->flags |= BOUNDARY_SHOW;
184+
o->flags |= PREREQ_MARK;
183185
add_pending_object(&revs, o, e->name);
184186
continue;
185187
}
@@ -202,7 +204,7 @@ static int verify_bundle(struct bundle_header *header)
202204

203205
i = req_nr;
204206
while (i && (commit = get_revision(&revs)))
205-
if (commit->object.flags & BOUNDARY_SHOW)
207+
if (commit->object.flags & PREREQ_MARK)
206208
i--;
207209

208210
for (i = 0; i < req_nr; i++)

revision.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,17 +1285,21 @@ struct commit *get_revision(struct rev_info *revs)
12851285
commit_list_insert(c, &l);
12861286
revs->commits = l;
12871287
revs->reverse = 0;
1288+
c = NULL;
12881289
}
12891290

12901291
/*
12911292
* Now pick up what they want to give us
12921293
*/
1293-
c = get_revision_1(revs);
1294+
if (!(c = get_revision_1(revs)))
1295+
return NULL;
12941296
while (0 < revs->skip_count) {
12951297
revs->skip_count--;
12961298
c = get_revision_1(revs);
12971299
if (!c)
12981300
break;
1301+
/* Although we grabbed it, it is not shown. */
1302+
c->object.flags &= ~SHOWN;
12991303
}
13001304

13011305
/*
@@ -1305,6 +1309,9 @@ struct commit *get_revision(struct rev_info *revs)
13051309
case -1:
13061310
break;
13071311
case 0:
1312+
/* Although we grabbed it, it is not shown. */
1313+
if (c)
1314+
c->object.flags &= ~SHOWN;
13081315
c = NULL;
13091316
break;
13101317
default:

revision.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
#define SHOWN (1u<<3)
88
#define TMP_MARK (1u<<4) /* for isolated cases; clean after use */
99
#define BOUNDARY (1u<<5)
10-
#define BOUNDARY_SHOW (1u<<6)
10+
#define CHILD_SHOWN (1u<<6)
1111
#define ADDED (1u<<7) /* Parents already parsed and added? */
1212
#define SYMMETRIC_LEFT (1u<<8)
13-
#define CHILD_SHOWN (1u<<9)
1413

1514
struct rev_info;
1615
struct log_info;

0 commit comments

Comments
 (0)