mirror of
https://github.com/git/git.git
synced 2026-04-11 09:20:10 +02:00
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
This commit is contained in:
@@ -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' '
|
||||
|
||||
Reference in New Issue
Block a user