summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Eric Sunshine <sunshine@sunshineco.com>2018-08-28 17:20:24 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-30 09:28:02 -0700
commit68a6b3a1bd45eb1814a0c1cedfe347692c3f2ff7 (patch)
tree2179e2f878c546a9cbf6e803dd9d860dd0b08340 /t
parentworktree: teach 'add' to respect --force for registered but missing path (diff)
downloadtgif-68a6b3a1bd45eb1814a0c1cedfe347692c3f2ff7.tar.xz
worktree: teach 'move' to override lock when --force given twice
For consistency with "add -f -f", which allows a missing but locked worktree path to be re-used, allow "move -f -f" to override a lock, as well, as a convenience. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t2028-worktree-move.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh
index 60aba7c41a..9756ede8f1 100755
--- a/t/t2028-worktree-move.sh
+++ b/t/t2028-worktree-move.sh
@@ -98,6 +98,20 @@ test_expect_success 'move worktree to another dir' '
test_cmp expected2 actual2
'
+test_expect_success 'move locked worktree (force)' '
+ test_when_finished "
+ git worktree unlock flump || :
+ git worktree remove flump || :
+ git worktree unlock ploof || :
+ git worktree remove ploof || :
+ " &&
+ git worktree add --detach flump &&
+ git worktree lock flump &&
+ test_must_fail git worktree move flump ploof" &&
+ test_must_fail git worktree move --force flump ploof" &&
+ git worktree move --force --force flump ploof
+'
+
test_expect_success 'remove main worktree' '
test_must_fail git worktree remove .
'