diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-08-16 04:13:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-16 04:13:13 -0700 |
commit | 14683af812ee0b19c416223287c6e330dbdc9ffc (patch) | |
tree | 8f6aba92fa7a9e1f088129b1ebc4f6082d4c8d31 /t | |
parent | b21f9e7f860620571667fba33ed511bed59dfb14 (diff) | |
parent | a0f4afbe87ddda7902e36350d163dea146166550 (diff) | |
download | git-14683af812ee0b19c416223287c6e330dbdc9ffc.tar.gz |
Merge branch 'jc/maint-clean-nested-dir-safety'
* jc/maint-clean-nested-dir-safety:
clean: require double -f options to nuke nested git repository and work tree
Diffstat (limited to 't')
-rwxr-xr-x | t/t7300-clean.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 929d5d4d3b..118c6ebb18 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -380,4 +380,43 @@ test_expect_success 'removal failure' ' ' chmod 755 foo +test_expect_success 'nested git work tree' ' + rm -fr foo bar && + mkdir foo bar && + ( + cd foo && + git init && + >hello.world + git add . && + git commit -a -m nested + ) && + ( + cd bar && + >goodbye.people + ) && + git clean -f -d && + test -f foo/.git/index && + test -f foo/hello.world && + ! test -d bar +' + +test_expect_success 'force removal of nested git work tree' ' + rm -fr foo bar && + mkdir foo bar && + ( + cd foo && + git init && + >hello.world + git add . && + git commit -a -m nested + ) && + ( + cd bar && + >goodbye.people + ) && + git clean -f -f -d && + ! test -d foo && + ! test -d bar +' + test_done |