Slightly friendlier pre-commit errors.

Make the pre-commit check spit out cut-and-paste commands and be more
obvious about errors.  Tested by making an invalid change and observing the
message generated.
This commit is contained in:
Tim Hockin
2014-06-24 15:01:08 -07:00
parent 7622bb871b
commit b6d5faf276
2 changed files with 35 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
if [[ "$(grep -c "# then delete this line" $1)" == "1" ]]; then
echo "Unresolved gofmt errors. Aborting commit."
if [[ "$(grep -c "COMMIT_BLOCKED" $1)" -gt 0 ]]; then
echo "FAILED: Unresolved errors - aborting the commit."
echo "The message of your attempted commit was:"
cat $1
exit 1