Commit a4ded362 by Carlos Martín Nieto

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.
parent 6a0d5696
...@@ -1027,8 +1027,11 @@ static int dirload_with_stat( ...@@ -1027,8 +1027,11 @@ static int dirload_with_stat(
strncomp = (flags & GIT_PATH_DIR_IGNORE_CASE) != 0 ? strncomp = (flags & GIT_PATH_DIR_IGNORE_CASE) != 0 ?
git__strncasecmp : git__strncmp; 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; goto done;
}
while ((error = git_path_diriter_next(&diriter)) == 0) { while ((error = git_path_diriter_next(&diriter)) == 0) {
if ((error = git_path_diriter_fullpath(&path, &path_len, &diriter)) < 0) if ((error = git_path_diriter_fullpath(&path, &path_len, &diriter)) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment