diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-08-26 12:05:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-26 12:05:57 -0700 |
commit | b8132342e9fed8470037b0e31f60f668bace0725 (patch) | |
tree | 78963febd7d4ccf5c812073b53d3d1b8256a771e /t | |
parent | bd30037e65c53112dd84c2712750e152b2f7f854 (diff) | |
parent | a0f4afbe87ddda7902e36350d163dea146166550 (diff) | |
download | git-b8132342e9fed8470037b0e31f60f668bace0725.tar.gz |
Merge branch 'jc/maint-clean-nested-dir-safety' into maint
* 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 |