Skip to content

Commit 8425063

Browse files
pks-tgitster
authored andcommitted
t9902: fix use of read with set -e
In t9902 we're using the `read` builtin to read some values into a variable. This is done by using `-d ""`, which cause us to read until the end of the heredoc. As the read is terminated by EOF, the command will end up returning a non-zero error code. This hasn't been an issue until now as we didn't run with `set -e`, but that'll change in a subsequent commit. Prepare for this change by not using read at all, as we can simply store the multi-line value directly. Suggested-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b2e636f commit 8425063

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

t/t9902-completion.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,12 +590,10 @@ test_expect_success '__gitcomp - doesnt fail because of invalid variable name' '
590590
__gitcomp "$invalid_variable_name"
591591
'
592592

593-
read -r -d "" refs <<-\EOF
594-
main
593+
refs='main
595594
maint
596595
next
597-
seen
598-
EOF
596+
seen'
599597

600598
test_expect_success '__gitcomp_nl - trailing space' '
601599
test_gitcomp_nl "m" "$refs" <<-EOF

0 commit comments

Comments
 (0)