SZEDER Gábor <szeder.dev@xxxxxxxxx> writes: > There is one more issue in these tests. > ... > The main purpose of this test script is to test the 'git worktree' > command, but these pipes hide its exit code. > Could you please save 'git worktree's output into an intermediate > file, and run 'grep' on the file's contents? Here is what I tentatively came up with, while deciding what should be queued based on Eric's patch, as a possible squash/fixup. t/t2028-worktree-move.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh index d70d13dabe..1c391f370e 100755 --- a/t/t2028-worktree-move.sh +++ b/t/t2028-worktree-move.sh @@ -7,7 +7,8 @@ test_description='test git worktree move, remove, lock and unlock' test_expect_success 'setup' ' test_commit init && git worktree add source && - git worktree list --porcelain | grep "^worktree" >actual && + git worktree list --porcelain >out && + grep "^worktree" out >actual && cat <<-EOF >expected && worktree $(pwd) worktree $(pwd)/source @@ -74,8 +75,10 @@ test_expect_success 'move worktree' ' toplevel="$(pwd)" && git worktree move source destination && test_path_is_missing source && - git worktree list --porcelain | grep "^worktree.*/destination" && - ! git worktree list --porcelain | grep "^worktree.*/source" && + git worktree list --porcelain >out && + grep "^worktree.*/destination" out && + git worktree list --porcelain >out && + ! grep "^worktree.*/source" out && git -C destination log --format=%s >actual2 && echo init >expected2 && test_cmp expected2 actual2 @@ -90,7 +93,8 @@ test_expect_success 'move worktree to another dir' ' git worktree move destination some-dir && test_when_finished "git worktree move some-dir/destination destination" && test_path_is_missing destination && - git worktree list --porcelain | grep "^worktree.*/some-dir/destination" && + git worktree list --porcelain >out && + grep "^worktree.*/some-dir/destination" out && git -C some-dir/destination log --format=%s >actual2 && echo init >expected2 && test_cmp expected2 actual2