revision traversal: SHOWN means shown
This moves the code to set SHOWN on the commit from get_revision_1() back to get_revision(), so that the bit means what it originally meant: this commit has been given back to the caller. Also it fixes the --reverse breakage Dscho pointed out. Signed-off-by: Junio C Hamano <junkio@cox.net>maint
parent
c2dea5a11c
commit
c33d859385
26
revision.c
26
revision.c
|
@ -1227,7 +1227,6 @@ static struct commit *get_revision_1(struct rev_info *revs)
|
||||||
if (revs->parents)
|
if (revs->parents)
|
||||||
rewrite_parents(revs, commit);
|
rewrite_parents(revs, commit);
|
||||||
}
|
}
|
||||||
commit->object.flags |= SHOWN;
|
|
||||||
return commit;
|
return commit;
|
||||||
} while (revs->commits);
|
} while (revs->commits);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1280,11 +1279,22 @@ struct commit *get_revision(struct rev_info *revs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (revs->reverse) {
|
if (revs->reverse) {
|
||||||
|
int limit = -1;
|
||||||
|
|
||||||
|
if (0 <= revs->max_count) {
|
||||||
|
limit = revs->max_count;
|
||||||
|
if (0 < revs->skip_count)
|
||||||
|
limit += revs->skip_count;
|
||||||
|
}
|
||||||
l = NULL;
|
l = NULL;
|
||||||
while ((c = get_revision_1(revs)))
|
while ((c = get_revision_1(revs))) {
|
||||||
commit_list_insert(c, &l);
|
commit_list_insert(c, &l);
|
||||||
|
if ((0 < limit) && !--limit)
|
||||||
|
break;
|
||||||
|
}
|
||||||
revs->commits = l;
|
revs->commits = l;
|
||||||
revs->reverse = 0;
|
revs->reverse = 0;
|
||||||
|
revs->max_count = -1;
|
||||||
c = NULL;
|
c = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,8 +1308,6 @@ struct commit *get_revision(struct rev_info *revs)
|
||||||
c = get_revision_1(revs);
|
c = get_revision_1(revs);
|
||||||
if (!c)
|
if (!c)
|
||||||
break;
|
break;
|
||||||
/* Although we grabbed it, it is not shown. */
|
|
||||||
c->object.flags &= ~SHOWN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1310,16 +1318,18 @@ struct commit *get_revision(struct rev_info *revs)
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
/* Although we grabbed it, it is not shown. */
|
/* Although we grabbed it, it is not shown. */
|
||||||
if (c)
|
|
||||||
c->object.flags &= ~SHOWN;
|
|
||||||
c = NULL;
|
c = NULL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
revs->max_count--;
|
revs->max_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!revs->boundary)
|
if (c)
|
||||||
|
c->object.flags |= SHOWN;
|
||||||
|
|
||||||
|
if (!revs->boundary) {
|
||||||
return c;
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
if (!c) {
|
if (!c) {
|
||||||
/*
|
/*
|
||||||
|
@ -1341,7 +1351,7 @@ struct commit *get_revision(struct rev_info *revs)
|
||||||
for (l = c->parents; l; l = l->next) {
|
for (l = c->parents; l; l = l->next) {
|
||||||
struct object *p;
|
struct object *p;
|
||||||
p = &(l->item->object);
|
p = &(l->item->object);
|
||||||
if (p->flags & CHILD_SHOWN)
|
if (p->flags & (CHILD_SHOWN | SHOWN))
|
||||||
continue;
|
continue;
|
||||||
p->flags |= CHILD_SHOWN;
|
p->flags |= CHILD_SHOWN;
|
||||||
gc_boundary(&revs->boundary_commits);
|
gc_boundary(&revs->boundary_commits);
|
||||||
|
|
Loading…
Reference in New Issue