Fix arcanist documentation to include "set -e" in example SVN hooks
Summary: "set -e" causes the script to exit if any command returns nonzero.
Without it, we incorrectly discard the failure code. At Facebook everything runs
in "set -e" or some equivalent so I never picked this up in testing.
Test Plan:
Added the hook to my svn local, it blocked bad commits and allowed good ones.
>>> orbital:~/devtools/svnroot $ svn commit -m "quaa"
Sending test.php
Transmitting file data .svn: Commit failed (details follow):
svn: Commit blocked by pre-commit hook (exit code 1) with output:
LINT ERRORS
This changeset has lint errors. You must fix all lint errors before you can
commit.
You can add '@bypass-lint' to your commit message to disable lint checks for
this commit, or '@nolint' to the file with errors to disable lint for that
file.
>>> Lint for test.php:
Error (XHP1) PHP Syntax Error!
This file contains a syntax error: XHPAST Parse Error: syntax error,
unexpected '}' on line 1
>>> 1 <?php asdddddd;!}}
Reviewers: svemir, jungejason, tuomaspelkonen, aran
Reviewed By: svemir
CC: aran, svemir, epriestley
Differential Revision: 864
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
Describes how to set up Arcanist as an SVN pre-commit hook.
|
||||
|
||||
NOTE: This whole thing might be a little shaky and take a touch of finesse.
|
||||
|
||||
= Installing Arcanist SVN Hooks =
|
||||
|
||||
You can install Arcanist as an SVN pre-commit hook, to reject commits which
|
||||
@@ -13,6 +15,7 @@ engines.
|
||||
To install Arcanist as a pre-commit hook, add this to your svn/hooks/pre-commit:
|
||||
|
||||
#!/bin/sh
|
||||
set -e # Exit with an error code if this fails.
|
||||
/usr/local/bin/php -f /path/to/arcanist/bin/arc svn-hook-pre-commit $@ 1>&2
|
||||
|
||||
Make sure you make this file executable, or you'll get an error for every commit
|
||||
@@ -31,6 +34,7 @@ build new linters or customize lint engines. For example, your hook might
|
||||
look like this:
|
||||
|
||||
#!/bin/sh
|
||||
set -e # Exit with an error code if this fails.
|
||||
/usr/local/bin/php -f /path/to/arcanist/bin/arc svn-hook-pre-commit \
|
||||
--load-phutil-library=/path/to/custom/lint/engine \
|
||||
--load-phutil-library=/path/to/custom/unittest/engine \
|
||||
|
||||
Reference in New Issue
Block a user