summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2016-10-06 18:13:34 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2016-10-06 18:13:34 +0200
commitfedc05c89ceb545f29c57bf35ffd066bd9e49386 (patch)
tree47dd7ffa03529c1459a0ced98cbf21b5ec5385b3
parent3cc5ec94f8d4753d00e7c407d0033187fe79eb08 (diff)
downloadlibgit2-fedc05c89ceb545f29c57bf35ffd066bd9e49386.tar.gz
revwalk: don't show commits that become uninteresting after being enqueuedcmn/walk-limit-enough
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.
-rw-r--r--src/revwalk.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/revwalk.c b/src/revwalk.c
index 4753a3723..0ada5870a 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -246,9 +246,12 @@ static int revwalk_next_unsorted(git_commit_list_node **object_out, git_revwalk
{
git_commit_list_node *next;
- if ((next = git_commit_list_pop(&walk->iterator_rand)) != NULL) {
- *object_out = next;
- return 0;
+ while ((next = git_commit_list_pop(&walk->iterator_rand)) != NULL) {
+ /* Some commits might become uninteresting after being added to the list */
+ if (!next->uninteresting) {
+ *object_out = next;
+ return 0;
+ }
}
giterr_clear();
@@ -257,12 +260,14 @@ static int revwalk_next_unsorted(git_commit_list_node **object_out, git_revwalk
static int revwalk_next_toposort(git_commit_list_node **object_out, git_revwalk *walk)
{
- git_commit_list_node *node;
+ git_commit_list_node *next;
- node = git_commit_list_pop(&walk->iterator_topo);
- if (node) {
- *object_out = node;
- return 0;
+ while ((next = git_commit_list_pop(&walk->iterator_topo)) != NULL) {
+ /* Some commits might become uninteresting after being added to the list */
+ if (!next->uninteresting) {
+ *object_out = next;
+ return 0;
+ }
}
giterr_clear();