From a650898420953e45abc3f2ae20de5fffa6366049 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 19 Sep 2023 21:15:00 -0400 Subject: Fix checking of grep exitcode This is one of those things that's hard to get right because it depends on the state of the git repo to exercise all code paths. --- Biz/Ide/hooks/pre-push | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Biz/Ide/hooks/pre-push b/Biz/Ide/hooks/pre-push index 863c687..baf7a13 100755 --- a/Biz/Ide/hooks/pre-push +++ b/Biz/Ide/hooks/pre-push @@ -19,9 +19,12 @@ commit=$(git notes --ref=ci show $local_ref || true) if [[ -n "$commit" ]] then - lint_ok=$(grep "Lint-is: good" <<< $commit) - test_ok=$(grep "Test-is: good" <<< $commit) - if [[ $lint_ok -eq 0 || $test_ok -eq 0 ]] + lint_ok=$() + if grep -q "Lint-is: good" <<< $commit + then + exit 0 + fi + if grep -q "Test-is: good" <<< $commit then exit 0 fi -- cgit v1.2.3