insgesamt 28 drwxr-xr-x 2 jkrueger jkrueger 4096 Apr 3 09:25 abc -rw-r--r-- 1 jkrueger jkrueger 155 Apr 3 09:25 actual drwxr-xr-x 2 jkrueger jkrueger 4096 Apr 3 09:25 destination drwxr-xr-x 2 jkrueger jkrueger 4096 Apr 3 09:25 elsewhere -rw-r--r-- 1 jkrueger jkrueger 7 Apr 3 09:25 expected -rw-r--r-- 1 jkrueger jkrueger 5 Apr 3 09:25 init.t -rw-r--r-- 1 jkrueger jkrueger 463 Apr 3 09:25 out
Initialized empty Git repository in /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move/.git/
expecting success:
test_commit init &&
git worktree add source &&
git worktree list --porcelain >out &&
grep "^worktree" out >actual &&
cat <<-EOF >expected &&
worktree $(pwd)
worktree $(pwd)/source
EOF
test_cmp expected actual
[master (root-commit) 2519212] init
Author: A U Thor <author@example.com>
1 file changed, 1 insertion(+)
create mode 100644 init.t
Preparing source (identifier source)
HEAD is now at 2519212 init
ok 1 - setup
expecting success:
test_must_fail git worktree lock .
fatal: The main working tree cannot be locked or unlocked ok 2 - lock main worktree
expecting success:
git worktree lock --reason hahaha source &&
echo hahaha >expected &&
test_cmp expected .git/worktrees/source/locked
ok 3 - lock linked worktree
expecting success:
rm .git/worktrees/source/locked &&
git worktree add elsewhere &&
git -C elsewhere worktree lock --reason hahaha ../source &&
echo hahaha >expected &&
test_cmp expected .git/worktrees/source/locked
Preparing elsewhere (identifier elsewhere) HEAD is now at 2519212 init ok 4 - lock linked worktree from another worktree
expecting success:
test_must_fail git worktree lock source &&
echo hahaha >expected &&
test_cmp expected .git/worktrees/source/locked
fatal: 'source' is already locked, reason: hahaha ok 5 - lock worktree twice
expecting success:
test_must_fail git -C source worktree lock . &&
echo hahaha >expected &&
test_cmp expected .git/worktrees/source/locked
fatal: '.' is already locked, reason: hahaha ok 6 - lock worktree twice (from the locked worktree)
expecting success:
test_must_fail git worktree unlock .
fatal: The main working tree cannot be locked or unlocked ok 7 - unlock main worktree
expecting success:
git worktree unlock source &&
test_path_is_missing .git/worktrees/source/locked
ok 8 - unlock linked worktree
expecting success:
test_must_fail git worktree unlock source &&
test_path_is_missing .git/worktrees/source/locked
fatal: 'source' is not locked ok 9 - unlock worktree twice
expecting success:
mkdir abc &&
test_must_fail git worktree move abc def
fatal: 'abc' is not a working tree ok 10 - move non-worktree
expecting success:
git worktree lock source &&
test_when_finished "git worktree unlock source" &&
test_must_fail git worktree move source destination
fatal: cannot move a locked working tree ok 11 - move locked worktree
expecting success:
toplevel="$(pwd)" &&
git worktree move source destination &&
test_path_is_missing source &&
git worktree list --porcelain >out &&
grep "^worktree.*/destination" out &&
! grep "^worktree.*/source" out &&
git -C destination log --format=%s >actual2 &&
echo init >expected2 &&
test_cmp expected2 actual2
worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move/destination worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move/destination worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move/elsewhere not ok 12 - move worktree # # toplevel="$(pwd)" && # git worktree move source destination && # test_path_is_missing source && # git worktree list --porcelain >out && # grep "^worktree.*/destination" out && # ! grep "^worktree.*/source" out && # git -C destination log --format=%s >actual2 && # echo init >expected2 && # test_cmp expected2 actual2 #
worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move/source
worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move HEAD 2519212edd1f577b6196d394a0f08b31d5faa951 branch refs/heads/master
worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move/elsewhere HEAD 2519212edd1f577b6196d394a0f08b31d5faa951 branch refs/heads/elsewhere
worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move/some-dir/destination HEAD 2519212edd1f577b6196d394a0f08b31d5faa951 branch refs/heads/source