diff options
| author | Achu Luma <ach.lumap@gmail.com> | 2024-01-20 03:15:47 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-01-20 10:27:18 -0800 |
| commit | 425ae8a3df3d2378e8da5a96b995f8fc0fac32e8 (patch) | |
| tree | 4044ed31184884d6ccd1e54716c5b797d1bcf3e7 /t/t2400-worktree-add.sh | |
| parent | The ninth batch (diff) | |
| download | git-425ae8a3df3d2378e8da5a96b995f8fc0fac32e8.tar.gz git-425ae8a3df3d2378e8da5a96b995f8fc0fac32e8.zip | |
t2400: avoid losing exit status to pipes
The exit code of the preceding command in a pipe is disregarded. So
if that preceding command is a Git command that fails, the test would
not fail. Instead, by saving the output of that Git command to a file,
and removing the pipe, we make sure the test will fail if that Git
command fails.
Signed-off-by: Achu Luma <ach.lumap@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2400-worktree-add.sh')
| -rwxr-xr-x | t/t2400-worktree-add.sh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh index 3742971105..c28c04133c 100755 --- a/t/t2400-worktree-add.sh +++ b/t/t2400-worktree-add.sh @@ -490,7 +490,8 @@ test_expect_success 'put a worktree under rebase' ' cd under-rebase && set_fake_editor && FAKE_LINES="edit 1" git rebase -i HEAD^ && - git worktree list | grep "under-rebase.*detached HEAD" + git worktree list >actual && + grep "under-rebase.*detached HEAD" actual ) ' @@ -531,7 +532,8 @@ test_expect_success 'checkout a branch under bisect' ' git bisect start && git bisect bad && git bisect good HEAD~2 && - git worktree list | grep "under-bisect.*detached HEAD" && + git worktree list >actual && + grep "under-bisect.*detached HEAD" actual && test_must_fail git worktree add new-bisect under-bisect && ! test -d new-bisect ) |
