Commit 5c3b8ef4 by Edward Thomson

Ignore files that disappear while iterating

On occasion, files can disappear while we're iterating the
filesystem, between calls to readdir and stat.  Let's pretend
those didn't exist in the first place.
parent 4a1b4015
...@@ -902,8 +902,16 @@ int git_path_dirload_with_stat( ...@@ -902,8 +902,16 @@ int git_path_dirload_with_stat(
git_buf_truncate(&full, prefix_len); git_buf_truncate(&full, prefix_len);
if ((error = git_buf_joinpath(&full, full.ptr, ps->path)) < 0 || if ((error = git_buf_joinpath(&full, full.ptr, ps->path)) < 0 ||
(error = git_path_lstat(full.ptr, &ps->st)) < 0) (error = git_path_lstat(full.ptr, &ps->st)) < 0) {
if (error == GIT_ENOTFOUND) {
giterr_clear();
error = 0;
git_vector_remove(contents, i--);
continue;
}
break; break;
}
if (S_ISDIR(ps->st.st_mode)) { if (S_ISDIR(ps->st.st_mode)) {
if ((error = git_buf_joinpath(&full, full.ptr, ".git")) < 0) if ((error = git_buf_joinpath(&full, full.ptr, ".git")) < 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