1
0
mirror of https://github.com/git/git.git synced 2024-09-28 18:32:37 +02:00

Merge branch 'ar/clean-rmdir-empty'

* ar/clean-rmdir-empty:
  clean: unreadable directory may still be rmdir-able if it is empty
This commit is contained in:
Junio C Hamano 2011-04-27 11:36:41 -07:00
commit 1de0746d84
2 changed files with 8 additions and 1 deletions

2
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, '/');

@ -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