From 5c3b8ef48bcbf0843cdc7272fec7a32819998f58 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Tue, 24 Sep 2013 14:52:58 -0400 Subject: [PATCH] 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. --- src/path.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/path.c b/src/path.c index 42b3d6f3e..9d8e90361 100644 --- a/src/path.c +++ b/src/path.c @@ -902,8 +902,16 @@ int git_path_dirload_with_stat( git_buf_truncate(&full, prefix_len); 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; + } if (S_ISDIR(ps->st.st_mode)) { if ((error = git_buf_joinpath(&full, full.ptr, ".git")) < 0)