Skip to content

Commit 391b493

Browse files
committed
Merge branch 'ar/clean-rmdir-empty' into maint
* ar/clean-rmdir-empty: clean: unreadable directory may still be rmdir-able if it is empty
2 parents a3402c1 + 0235017 commit 391b493

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ int remove_dir_recursively(struct strbuf *path, int flag)
11921192

11931193
dir = opendir(path->buf);
11941194
if (!dir)
1195-
return -1;
1195+
return rmdir(path->buf);
11961196
if (path->buf[original_len - 1] != '/')
11971197
strbuf_addch(path, '/');
11981198

t/t7300-clean.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,4 +453,11 @@ test_expect_success 'git clean -e' '
453453
)
454454
'
455455

456+
test_expect_success SANITY 'git clean -d with an unreadable empty directory' '
457+
mkdir foo &&
458+
chmod a= foo &&
459+
git clean -dfx foo &&
460+
! test -d foo
461+
'
462+
456463
test_done

0 commit comments

Comments
 (0)