Skip to content

Commit fedc05c

Browse files
committed
revwalk: don't show commits that become uninteresting after being enqueued
When we read from the list which `limit_list()` gives us, we need to check that the commit is still interesting, as it might have become uninteresting after it was added to the list.
1 parent 3cc5ec9 commit fedc05c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/revwalk.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,12 @@ static int revwalk_next_unsorted(git_commit_list_node **object_out, git_revwalk
246246
{
247247
git_commit_list_node *next;
248248

249-
if ((next = git_commit_list_pop(&walk->iterator_rand)) != NULL) {
250-
*object_out = next;
251-
return 0;
249+
while ((next = git_commit_list_pop(&walk->iterator_rand)) != NULL) {
250+
/* Some commits might become uninteresting after being added to the list */
251+
if (!next->uninteresting) {
252+
*object_out = next;
253+
return 0;
254+
}
252255
}
253256

254257
giterr_clear();
@@ -257,12 +260,14 @@ static int revwalk_next_unsorted(git_commit_list_node **object_out, git_revwalk
257260

258261
static int revwalk_next_toposort(git_commit_list_node **object_out, git_revwalk *walk)
259262
{
260-
git_commit_list_node *node;
263+
git_commit_list_node *next;
261264

262-
node = git_commit_list_pop(&walk->iterator_topo);
263-
if (node) {
264-
*object_out = node;
265-
return 0;
265+
while ((next = git_commit_list_pop(&walk->iterator_topo)) != NULL) {
266+
/* Some commits might become uninteresting after being added to the list */
267+
if (!next->uninteresting) {
268+
*object_out = next;
269+
return 0;
270+
}
266271
}
267272

268273
giterr_clear();

0 commit comments

Comments
 (0)