t5703: simplify one-time-sed generation logic
commiteacaa1c18096e96c391c1246e91c43f35834e49e
authorDenton Liu <liu.denton@gmail.com>
Wed, 27 Nov 2019 19:53:36 +0000 (27 11:53 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Nov 2019 21:20:15 +0000 (29 13:20 -0800)
treea4440b6d53e1a3185566512bbb0396defe4b603a
parenta29b2429e583794c27d9527e105b1ce7500e8062
t5703: simplify one-time-sed generation logic

In inconsistency(), we had two `git rev-parse` invocations in the
upstream of a pipe within a command substitution. In case this
invocation ever failed, its exit code would be swallowed up and we would
not know about it.

Pull the command substitutions out into variable assignments so that
their return codes are not lost.

Drop the pipe into `tr` because the $(...) substitution already takes
care of stripping out newlines, so the `tr` invocations in the code are
superfluous.

Finally, given the way the tests actually employ "one-time-sed" via
$(cat one-time-sed) in t/lib-httpd/apply-one-time-sed.sh, convert the
`printf` into an `echo`. This makes it consistent with the final "server
loses a ref - ref in want" test, which does use `echo` rather than
`printf`.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5703-upload-pack-ref-in-want.sh