From: Junio C Hamano Date: Wed, 27 Apr 2011 18:36:41 +0000 (-0700) Subject: Merge branch 'ar/clean-rmdir-empty' X-Git-Tag: v1.7.6-rc0~156 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1de0746d849c64e1f4d160f9915d87d39c0794ea?hp=385185403e74f3b4b52c33bb263ca735c512f66f Merge branch 'ar/clean-rmdir-empty' * ar/clean-rmdir-empty: clean: unreadable directory may still be rmdir-able if it is empty --- diff --git a/dir.c b/dir.c index 325fb56ad3..532bcb65b5 100644 --- a/dir.c +++ b/dir.c @@ -1192,7 +1192,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 7e1be44402..800b5368a5 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