summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-07-26 17:19:22 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-07-26 17:19:22 +0200
commit12786e0f7c0e6ea23b1483f8732ca23b367bfd8f (patch)
tree4b4cd36669cde2833e36b6fe2f4062097fd5744f
parent42156d561723e92ffe597885719aa63abfe0795c (diff)
downloadlibgit2-12786e0f7c0e6ea23b1483f8732ca23b367bfd8f.tar.gz
iterator: skip over errors in diriter init
An error here will typically mean that the directory was removed between the time we iterated the parent and the time we wanted to visit it in which case we should ignore it. Other kinds of errors such as permissions (or transient errors) also better dealt with by pretending we didn't see it.
-rw-r--r--src/iterator.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/iterator.c b/src/iterator.c
index a312afb3a..cf51a340d 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -1027,8 +1027,11 @@ static int dirload_with_stat(
strncomp = (flags & GIT_PATH_DIR_IGNORE_CASE) != 0 ?
git__strncasecmp : git__strncmp;
- if ((error = git_path_diriter_init(&diriter, dirpath, flags)) < 0)
+ /* Any error here is equivalent to the dir not existing, skip over it */
+ if ((error = git_path_diriter_init(&diriter, dirpath, flags)) < 0) {
+ error = GIT_ENOTFOUND;
goto done;
+ }
while ((error = git_path_diriter_next(&diriter)) == 0) {
if ((error = git_path_diriter_fullpath(&path, &path_len, &diriter)) < 0)