(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"test git worktree move, remove, lock and unlock">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <"\n"> <"\ttest_commit init &&\n"> <"\tgit worktree add source &&\n"> <"\tgit worktree list --porcelain | grep \"^worktree\" >actual &&\n"> <"\tcat <<-EOF >expected &&\n"> <"\tworktree $(pwd)\n"> <"\tworktree $(pwd)/source\n"> <"\tEOF\n"> <"\ttest_cmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"lock main worktree">)} {(SQ <"\n"> <"\ttest_must_fail git worktree lock .\n">)} ) (C {(test_expect_success)} {(SQ <"lock linked worktree">)} { (SQ <"\n"> <"\tgit worktree lock --reason hahaha source &&\n"> <"\techo hahaha >expected &&\n"> <"\ttest_cmp expected .git/worktrees/source/locked\n"> ) } ) (C {(test_expect_success)} {(SQ <"lock linked worktree from another worktree">)} { (SQ <"\n"> <"\trm .git/worktrees/source/locked &&\n"> <"\tgit worktree add elsewhere &&\n"> <"\tgit -C elsewhere worktree lock --reason hahaha ../source &&\n"> <"\techo hahaha >expected &&\n"> <"\ttest_cmp expected .git/worktrees/source/locked\n"> ) } ) (C {(test_expect_success)} {(SQ <"lock worktree twice">)} { (SQ <"\n"> <"\ttest_must_fail git worktree lock source &&\n"> <"\techo hahaha >expected &&\n"> <"\ttest_cmp expected .git/worktrees/source/locked\n"> ) } ) (C {(test_expect_success)} {(SQ <"lock worktree twice (from the locked worktree)">)} { (SQ <"\n"> <"\ttest_must_fail git -C source worktree lock . &&\n"> <"\techo hahaha >expected &&\n"> <"\ttest_cmp expected .git/worktrees/source/locked\n"> ) } ) (C {(test_expect_success)} {(SQ <"unlock main worktree">)} {(SQ <"\n"> <"\ttest_must_fail git worktree unlock .\n">)} ) (C {(test_expect_success)} {(SQ <"unlock linked worktree">)} { (SQ <"\n"> <"\tgit worktree unlock source &&\n"> <"\ttest_path_is_missing .git/worktrees/source/locked\n"> ) } ) (C {(test_expect_success)} {(SQ <"unlock worktree twice">)} { (SQ <"\n"> <"\ttest_must_fail git worktree unlock source &&\n"> <"\ttest_path_is_missing .git/worktrees/source/locked\n"> ) } ) (C {(test_done)}) ] )