diff options
-rw-r--r-- | dir.c | 2 | ||||
-rwxr-xr-x | t/t7300-clean.sh | 7 |
2 files changed, 8 insertions, 1 deletions
@@ -1088,7 +1088,7 @@ int remove_dir_recursively(struct strbuf *path, int flag) dir = opendir(path->buf); if (!dir) - return -1; + return rmdir(path->buf); if (path->buf[original_len - 1] != '/') strbuf_addch(path, '/'); diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 02f67b73b7..9b12681f97 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -453,4 +453,11 @@ test_expect_success 'git clean -e' ' ) ' +test_expect_success SANITY 'git clean -d with an unreadable empty directory' ' + mkdir foo && + chmod a= foo && + git clean -dfx foo && + ! test -d foo +' + test_done |