Created
March 23, 2014 04:38
-
-
Save Genki-S/9718868 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
function run_test { | |
targets=$(git diff --cached --name-only) | |
orig_files=() | |
for file in $targets; do | |
if [ $(echo $file | grep '.*\.orig$') ]; then | |
orig_files=("${orig_files[@]}" "$file") | |
fi | |
done | |
if [ ${#orig_files[@]} -ne 0 ]; then | |
echo 'Abort: You are going to commit *.orig files.' | |
echo "(files: ${orig_files[@]})" | |
echo 'If you are sure, commit with --no-verify option.' | |
exit 1 | |
fi | |
exit 0 | |
} | |
case "${1}" in | |
--about ) | |
echo "Check if *.orig file is intended to be commited" | |
;; | |
* ) | |
run_test | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment