Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge branch 'ar/clean-rmdir-empty'
Browse files Browse the repository at this point in the history
* ar/clean-rmdir-empty:
  clean: unreadable directory may still be rmdir-able if it is empty
  • Loading branch information
gitster committed Apr 27, 2011
2 parents 3851854 + 0235017 commit 1de0746
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, '/');

Expand Down
7 changes: 7 additions & 0 deletions t/t7300-clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1de0746

Please sign in to comment.