Re: [PATCH 1/3] t5730: introduce fetch command helper
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 9, 2021, 22:03 UTC
- Message-ID
- <xmqqpmume0oa.fsf@gitster.g>
- In-Reply-To
- <CDFBG4S23B1M.141X9FIPP7YHS@schmidt>
Kim Altintop <kim@eagain.st> writes:
Show 24 quoted lines
> Perhaps an alternative would be:
>
> write_fetch_command () {
> write_command fetch &&
> echo "0001" &&
> echo "no-progress" &&
> cat /dev/stdin &&
> echo "done" &&
> echo "0000"
> }
>
>
> Which would then be called like so:
>
> write_fetch_command >pkt_cmd <<-EOF &&
> want-ref refs/heads/main
> have $(git rev-parse a)
> EOF
> test-tool pkt-line pack <pkt_cmd >in &&
> test-tool serve-v2 --stateless-rpc >out <in &&
>
>
> I'm not sure how portable that is, though. Maybe using `while read -r` instead
> of `cat /dev/stdin`?If you drop /dev/stdin, the result would be emimently portable. "cat" without any argument reads from the standard input stream and copies it to the standard output stream.