What a mess.
#!/bin/sh if git rev-parse --verify HEAD >/dev/null 2>&1; then against=HEAD else # Initial commit: diff against an empty tree object against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi exec 1>&2 for FILE in `git diff-index --cached --name-status $against -- | cut -c3-`; do if grep -q 'NOCOMMIT' "$FILE"; then echo $FILE 'contains NOCOMMIT!' exit 1 fi done exit 0
The hook will prevent any file containing the text NOCOMMIT from being committed.
How to enable a global pre-commit hook.
For my future reference...
Make sure the Podfile
link_withvalue is only the app target, not the tests target.
In the tests target build settings, add "Pods/Public/Headers" as a recursive search path.
link_with the tests target, two bad things will happen:
CocoaPods will add a Link Binary With Libraries build phase to the tests target, but the pods are already statically linked with the app target.
CocoaPods will add Pods.xxx.config to the Debug and Release configurations for the tests target, which will add an
OTHER_LDFLAGSsetting for all of the individual libraries, but the pods are already statically linked with the app target.
This scene really needs a Roy Fielding overdub.