summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-02-24 13:26:00 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-02-24 13:26:00 -0800
commit595bfefa6c31fa6d76b686ed79b024838db5933e (patch)
tree0fdb54fcd57258da1904bcf11ff608a0184c3a36 /t
parentMerge branch 'nd/exclusion-regression-fix' (diff)
parentworktree add -B: do the checkout test before update branch (diff)
downloadtgif-595bfefa6c31fa6d76b686ed79b024838db5933e.tar.xz
Merge branch 'nd/worktree-add-B'
"git worktree add -B <branchname>" did not work. * nd/worktree-add-B: worktree add -B: do the checkout test before update branch worktree: fix "add -B"
Diffstat (limited to 't')
-rwxr-xr-xt/t2025-worktree-add.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh
index 0a804dab63..cbfa41ec61 100755
--- a/t/t2025-worktree-add.sh
+++ b/t/t2025-worktree-add.sh
@@ -193,6 +193,21 @@ test_expect_success '"add" -B/--detach mutually exclusive' '
test_must_fail git worktree add -B poodle --detach bamboo master
'
+test_expect_success '"add -B" fails if the branch is checked out' '
+ git rev-parse newmaster >before &&
+ test_must_fail git worktree add -B newmaster bamboo master &&
+ git rev-parse newmaster >after &&
+ test_cmp before after
+'
+
+test_expect_success 'add -B' '
+ git worktree add -B poodle bamboo2 master^ &&
+ git -C bamboo2 symbolic-ref HEAD >actual &&
+ echo refs/heads/poodle >expected &&
+ test_cmp expected actual &&
+ test_cmp_rev master^ poodle
+'
+
test_expect_success 'local clone from linked checkout' '
git clone --local here here-clone &&
( cd here-clone && git fsck )