summaryrefslogtreecommitdiff
path: root/src/iterator.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-03-16 10:17:20 -0400
committerEdward Thomson <ethomson@github.com>2016-03-23 17:16:37 -0400
commit4c88198a85932b69f779b2078f22b0231a18857e (patch)
treeb6ebbeb4947f2d7e0774393f9dee282215a91838 /src/iterator.c
parent0e0589fcc383a0ca96d342896103e01d715df755 (diff)
downloadlibgit2-4c88198a85932b69f779b2078f22b0231a18857e.tar.gz
iterator: test that we're at the end of iteration
Ensure that we have hit the end of iteration; previously we tested that we saw all the values that we expected to see. We did not then ensure that we were at the end of the iteration (and that there were subsequently values in the iteration that we did *not* expect.)
Diffstat (limited to 'src/iterator.c')
-rw-r--r--src/iterator.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/iterator.c b/src/iterator.c
index ce0fb0ec9..88b7ed28a 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -437,8 +437,10 @@ GIT_INLINE(bool) iterator_has_started(git_iterator *iter, const char *path)
GIT_INLINE(bool) iterator_has_ended(git_iterator *iter, const char *path)
{
- if (iter->end == NULL || iter->ended == true)
+ if (iter->end == NULL)
return false;
+ else if (iter->ended)
+ return true;
iter->ended = (iter->prefixcomp(path, iter->end) > 0);
return iter->ended;