summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-03-05 18:43:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-05 18:43:02 (GMT)
commit49e5043b09fffb0411e8bae19d60014e72a36fd0 (patch)
tree5d6afc8117d4bb235bfc36958e1375b0433a69c8 /t
parent2cbb0586697585995908c325a0c70aad37602274 (diff)
parentbb69b3b009c0093417942dba136b81fbf614c4ed (diff)
downloadgit-49e5043b09fffb0411e8bae19d60014e72a36fd0.zip
git-49e5043b09fffb0411e8bae19d60014e72a36fd0.tar.gz
git-49e5043b09fffb0411e8bae19d60014e72a36fd0.tar.bz2
Merge branch 'es/worktree-avoid-duplication-fix'
In rare cases "git worktree add <path>" could think that <path> was already a registered worktree even when it wasn't and refuse to add the new worktree. This has been corrected. * es/worktree-avoid-duplication-fix: worktree: don't allow "add" validation to be fooled by suffix matching worktree: add utility to find worktree by pathname worktree: improve find_worktree() documentation
Diffstat (limited to 't')
-rwxr-xr-xt/t2400-worktree-add.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh
index b5ece19..5a74954 100755
--- a/t/t2400-worktree-add.sh
+++ b/t/t2400-worktree-add.sh
@@ -570,6 +570,15 @@ test_expect_success '"add" an existing locked but missing worktree' '
git worktree add --force --force --detach gnoo
'
+test_expect_success '"add" not tripped up by magic worktree matching"' '
+ # if worktree "sub1/bar" exists, "git worktree add bar" in distinct
+ # directory `sub2` should not mistakenly complain that `bar` is an
+ # already-registered worktree
+ mkdir sub1 sub2 &&
+ git -C sub1 --git-dir=../.git worktree add --detach bozo &&
+ git -C sub2 --git-dir=../.git worktree add --detach bozo
+'
+
test_expect_success FUNNYNAMES 'sanitize generated worktree name' '
git worktree add --detach ". weird*..?.lock.lock" &&
test -d .git/worktrees/---weird-.-