From: Sean Whitton Date: Sat, 19 Oct 2019 17:33:10 +0000 (-0700) Subject: git-debpush: avoid a pipefail problem in get_file_from_ref X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=70df464217c2b96ea481cb3b28210b53a2d7e040 git-debpush: avoid a pipefail problem in get_file_from_ref `grep -q` exits as soon as it finds a matching line, potentially sending a SIGPIPE to git-ls-tree. We have pipefail turned on, so that can make the whole pipeline exit nonzero, which is wrong when grep did in fact find a match. This solution is more readable than disabling pipefail just for this line (as is done elsewhere in git-debpush). Closes: #940588 Reported-by: Andrej Shadura Signed-off-by: Sean Whitton --- diff --git a/git-debpush b/git-debpush index c3b067dc..2790560c 100755 --- a/git-debpush +++ b/git-debpush @@ -59,8 +59,10 @@ badusage () { get_file_from_ref () { local path=$1 + # redirect to /dev/null instead of using `grep -Eq` to avoid grep + # SIGPIPEing git-ls-tree if git ls-tree --name-only -r "$branch" \ - | grep -Eq "^$path$"; then + | grep -E "^$path$" >/dev/null; then git cat-file blob $branch:$path fi }