Commit a62ad3c3 by Vicent Marti

Merge pull request #2164 from libgit2/cmn/refs-delete-iteration

refdb: catch a directory disappearing
parents 967d3f2e a213a7bf
...@@ -853,6 +853,9 @@ int git_path_direach( ...@@ -853,6 +853,9 @@ int git_path_direach(
if ((dir = opendir(path->ptr)) == NULL) { if ((dir = opendir(path->ptr)) == NULL) {
giterr_set(GITERR_OS, "Failed to open directory '%s'", path->ptr); giterr_set(GITERR_OS, "Failed to open directory '%s'", path->ptr);
if (errno == ENOENT)
return GIT_ENOTFOUND;
return -1; return -1;
} }
......
...@@ -272,9 +272,17 @@ static int _dirent_loose_load(void *payload, git_buf *full_path) ...@@ -272,9 +272,17 @@ static int _dirent_loose_load(void *payload, git_buf *full_path)
if (git__suffixcmp(full_path->ptr, ".lock") == 0) if (git__suffixcmp(full_path->ptr, ".lock") == 0)
return 0; return 0;
if (git_path_isdir(full_path->ptr)) if (git_path_isdir(full_path->ptr)) {
return git_path_direach( int error = git_path_direach(
full_path, backend->direach_flags, _dirent_loose_load, backend); full_path, backend->direach_flags, _dirent_loose_load, backend);
/* Race with the filesystem, ignore it */
if (error == GIT_ENOTFOUND) {
giterr_clear();
return 0;
}
return error;
}
file_path = full_path->ptr + strlen(backend->path); file_path = full_path->ptr + strlen(backend->path);
......
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