From 959bb691cd079e4d11523d58cb137b77b66b1d74 Mon Sep 17 00:00:00 2001 From: Tyler Bindon Date: Sun, 9 Dec 2018 01:59:35 -0800 Subject: [PATCH] Update regex to match diffs output by cargo fmt. (#208) It appears the header of the diffs output by cargo fmt have changed. It now says "Diff in /blah/blah/blah.rs at line 99:" Matching on lines starting with + or - should be more future-proof against changes to the surroundings. --- hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index 51f9c33..a93bf91 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -96,7 +96,7 @@ do diff="$diff$(cargo fmt -- --skip-children --write-mode=diff $file)" fi done -if grep --quiet "^Diff at line" <<< "$diff"; then +if grep --quiet "^[-+]" <<< "$diff"; then FMTRESULT=1 fi