Browse Source

Merge branch 'ar/clean-rmdir-empty'

* ar/clean-rmdir-empty:
  clean: unreadable directory may still be rmdir-able if it is empty
maint
Junio C Hamano 14 years ago
parent
commit
1de0746d84
  1. 2
      dir.c
  2. 7
      t/t7300-clean.sh

2
dir.c

@ -1192,7 +1192,7 @@ int remove_dir_recursively(struct strbuf *path, int flag) @@ -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, '/');


7
t/t7300-clean.sh

@ -453,4 +453,11 @@ test_expect_success 'git clean -e' ' @@ -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

Loading…
Cancel
Save