On Sun, Jul 1, 2018 at 5:24 PM Eric Sunshine <sunsh...@sunshineco.com> wrote:
>
> These tests employ a noisy subshell (with missing &&-chain) to feed
> input into Git commands or files:
>
>     (echo a; echo b; echo c) | git some-command ...
>
> Simplify by taking advantage of test_write_lines():
>
>     test_write_lines a b c | git some-command ...

...
and as piped commands only return the exit code of
the last command in the piping structure this is ok,
as all git commands are the last command here.

If any of the non-last commands are failing (which
are the test_write_lines after this patch), we would
only care if the git command fails any way, as there is
no benefit in testing the correctness of test_write_lines.

This is why we chose to go this route instead of
writing the output to a file and then taking the file
as input for the git command. Although this alternative
might be easier to debug, we choose to not use that
as it would complicate this patch even more and these
tests did not need debugging for a long time.

Makes sense.

Stefan

Reply via email to