summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-07-28 13:17:58 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-07-28 13:17:58 -0700
commit01369fdfd3d0deec41c55306dae42f00dfbfa582 (patch)
tree1a4b11072413f2ff341603f5a6dc362565abc006 /t
parentMerge branch 'ew/many-alternate-optim' (diff)
parentworktree: teach `add` to accept --reason <string> with --lock (diff)
downloadtgif-01369fdfd3d0deec41c55306dae42f00dfbfa582.tar.xz
Merge branch 'sm/worktree-add-lock'
"git worktree add --lock" learned to record why the worktree is locked with a custom message. * sm/worktree-add-lock: worktree: teach `add` to accept --reason <string> with --lock worktree: mark lock strings with `_()` for translation t2400: clean up '"add" worktree with lock' test
Diffstat (limited to 't')
-rwxr-xr-xt/t2400-worktree-add.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh
index 96dfca1554..37ad79470f 100755
--- a/t/t2400-worktree-add.sh
+++ b/t/t2400-worktree-add.sh
@@ -67,11 +67,25 @@ test_expect_success '"add" worktree' '
'
test_expect_success '"add" worktree with lock' '
- git rev-parse HEAD >expect &&
git worktree add --detach --lock here-with-lock main &&
+ test_when_finished "git worktree unlock here-with-lock || :" &&
test -f .git/worktrees/here-with-lock/locked
'
+test_expect_success '"add" worktree with lock and reason' '
+ lock_reason="why not" &&
+ git worktree add --detach --lock --reason "$lock_reason" here-with-lock-reason main &&
+ test_when_finished "git worktree unlock here-with-lock-reason || :" &&
+ test -f .git/worktrees/here-with-lock-reason/locked &&
+ echo "$lock_reason" >expect &&
+ test_cmp expect .git/worktrees/here-with-lock-reason/locked
+'
+
+test_expect_success '"add" worktree with reason but no lock' '
+ test_must_fail git worktree add --detach --reason "why not" here-with-reason-only main &&
+ test_path_is_missing .git/worktrees/here-with-reason-only/locked
+'
+
test_expect_success '"add" worktree from a subdir' '
(
mkdir sub &&