[PATCH v6 11/12] t9902: fix use of `read` with `set -e`
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Apr 21, 2026, 07:34 UTC
- Message-ID
- <20260421-b4-pks-tests-with-set-e-v6-11-26330e3061ab@pks.im>
- In-Reply-To
- <20260421-b4-pks-tests-with-set-e-v6-0-26330e3061ab@pks.im>
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> --- t/t9902-completion.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 2f9a597ec7..28f61f08fb 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -590,12 +590,10 @@ test_expect_success '__gitcomp - doesnt fail because of invalid variable name' ' __gitcomp "$invalid_variable_name" ' -read -r -d "" refs <<-\EOF -main +refs='main maint next -seen -EOF +seen' test_expect_success '__gitcomp_nl - trailing space' ' test_gitcomp_nl "m" "$refs" <<-EOF
-- 2.54.0.545.g6539524ca2.dirty