diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/checkout.c | 3 | ||||
-rw-r--r-- | src/fileops.c | 4 | ||||
-rw-r--r-- | src/win32/posix_w32.c | 13 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/checkout.c b/src/checkout.c index 21f32d89a..e9ec2bdab 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -955,6 +955,9 @@ static int checkout_remove_the_old( uint32_t flg = GIT_RMDIR_EMPTY_PARENTS | GIT_RMDIR_REMOVE_FILES | GIT_RMDIR_REMOVE_BLOCKERS; + if (data->opts.checkout_strategy & GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES) + flg |= GIT_RMDIR_SKIP_NONEMPTY; + git_buf_truncate(&data->path, data->workdir_len); git_vector_foreach(&data->diff->deltas, i, delta) { diff --git a/src/fileops.c b/src/fileops.c index d6244711f..36f601706 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -444,7 +444,7 @@ static int futils__rmdir_recurs_foreach(void *opaque, git_buf *path) if (data->error < 0) { if ((data->flags & GIT_RMDIR_SKIP_NONEMPTY) != 0 && - (errno == ENOTEMPTY || errno == EEXIST)) + (errno == ENOTEMPTY || errno == EEXIST || errno == EBUSY)) data->error = 0; else futils__error_cannot_rmdir(path->ptr, NULL); @@ -480,7 +480,7 @@ static int futils__rmdir_empty_parent(void *opaque, git_buf *path) if (en == ENOENT || en == ENOTDIR) { giterr_clear(); error = 0; - } else if (en == ENOTEMPTY || en == EEXIST) { + } else if (en == ENOTEMPTY || en == EEXIST || en == EBUSY) { giterr_clear(); error = GIT_ITEROVER; } else { diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index 4d56299f7..a817d4245 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -314,9 +314,20 @@ int p_chmod(const char* path, mode_t mode) int p_rmdir(const char* path) { + int error; wchar_t buf[GIT_WIN_PATH]; git__utf8_to_16(buf, GIT_WIN_PATH, path); - return _wrmdir(buf); + + error = _wrmdir(buf); + + /* _wrmdir() is documented to return EACCES if "A program has an open + * handle to the directory." This sounds like what everybody else calls + * EBUSY. Let's convert appropriate error codes. + */ + if (GetLastError() == ERROR_SHARING_VIOLATION) + errno = EBUSY; + + return error; } int p_hide_directory__w32(const char *path) |