]> git.ipfire.org Git - thirdparty/git.git/commit
t7001: avoid git on upstream of pipe
authorJeff King <peff@peff.net>
Mon, 8 May 2023 19:01:12 +0000 (15:01 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 May 2023 21:50:28 +0000 (14:50 -0700)
commitb1c8ac3996e25c5764431f5ede122684474415c5
tree670343c0331712edd99a8403cf1bec2831a5c198
parent69c786637d7a7fe3b2b8f7d989af095f5f49c3a8
t7001: avoid git on upstream of pipe

We generally avoid git on the left-hand side of a pipe, because it loses
the exit code of the command (and thus we'd miss things like segfaults
or unexpected failures). In the cases in t7001, we wouldn't expect
failures (they are just inspecting the repository state, and are not the
main point of the test), but it doesn't hurt to be careful.

In all but one case here we're piping "ls-files --stage" to cut off the
pathname (since we compare entries before and after moving). Let's pull
that into a helper function to avoid repeating the slightly awkward
replacement.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7001-mv.sh