aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-08-26 12:05:57 -0700
committerJunio C Hamano <gitster@pobox.com>2009-08-26 12:05:57 -0700
commitb8132342e9fed8470037b0e31f60f668bace0725 (patch)
tree78963febd7d4ccf5c812073b53d3d1b8256a771e /t
parentbd30037e65c53112dd84c2712750e152b2f7f854 (diff)
parenta0f4afbe87ddda7902e36350d163dea146166550 (diff)
downloadgit-b8132342e9fed8470037b0e31f60f668bace0725.tar.gz
git-b8132342e9fed8470037b0e31f60f668bace0725.tar.xz
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-xt/t7300-clean.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 929d5d4d3..118c6ebb1 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