summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-04-16 12:40:22 -0700
committerJunio C Hamano <gitster@pobox.com>2012-04-16 12:40:22 -0700
commita2caeb2e26d57fdbbc35314d2f6ea2b872dbf54e (patch)
treeb518f2af6119706ebd6ee8ac771911cec596f11b /t
parent27ed4350b76deaaacc8b77d1272deec3433cbd38 (diff)
parentae2f203ef7be7b33ff5ec61646c8662363eccd62 (diff)
downloadgit-a2caeb2e26d57fdbbc35314d2f6ea2b872dbf54e.tar.gz
Merge branch 'jc/maint-clean-nested-worktree-in-subdir'
"git clean -d -f" (not "-d -f -f") is supposed to protect nested working trees of independent git repositories that exist in the current project working tree from getting removed, but the protection applied only to such working trees that are at the top-level of the current project by mistake. * jc/maint-clean-nested-worktree-in-subdir: clean: preserve nested git worktree in subdirectories
Diffstat (limited to 't')
-rwxr-xr-xt/t7300-clean.sh27
1 files changed, 22 insertions, 5 deletions
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 800b5368a5..ccfb54de7a 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -399,8 +399,8 @@ test_expect_success SANITY 'removal failure' '
'
test_expect_success 'nested git work tree' '
- rm -fr foo bar &&
- mkdir foo bar &&
+ rm -fr foo bar baz &&
+ mkdir -p foo bar baz/boo &&
(
cd foo &&
git init &&
@@ -412,15 +412,24 @@ test_expect_success 'nested git work tree' '
cd bar &&
>goodbye.people
) &&
+ (
+ cd baz/boo &&
+ git init &&
+ >deeper.world
+ git add . &&
+ git commit -a -m deeply.nested
+ ) &&
git clean -f -d &&
test -f foo/.git/index &&
test -f foo/hello.world &&
+ test -f baz/boo/.git/index &&
+ test -f baz/boo/deeper.world &&
! test -d bar
'
test_expect_success 'force removal of nested git work tree' '
- rm -fr foo bar &&
- mkdir foo bar &&
+ rm -fr foo bar baz &&
+ mkdir -p foo bar baz/boo &&
(
cd foo &&
git init &&
@@ -432,9 +441,17 @@ test_expect_success 'force removal of nested git work tree' '
cd bar &&
>goodbye.people
) &&
+ (
+ cd baz/boo &&
+ git init &&
+ >deeper.world
+ git add . &&
+ git commit -a -m deeply.nested
+ ) &&
git clean -f -f -d &&
! test -d foo &&
- ! test -d bar
+ ! test -d bar &&
+ ! test -d baz
'
test_expect_success 'git clean -e' '