From e8fcf0e4de3c0d65674505bc30a4b6b49099e241 Mon Sep 17 00:00:00 2001 From: Tim Kuehn Date: Sat, 27 Feb 2016 02:30:39 -0800 Subject: [PATCH] Fix issue with grep exit status --- hooks/pre-commit | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index 335bb2f..2db031a 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -93,8 +93,7 @@ for file in $(git diff --name-only --cached); do if [ ${file: -3} == ".rs" ]; then diff=$(rustfmt --skip-children --write-mode=diff $file) - result=$(echo $diff | grep --quiet "^Diff at line") - if $result; then + if grep --quiet "^Diff at line" <<< "$diff"; then FMTRESULT=1 fi fi