Skip to content

Instantly share code, notes, and snippets.

@Genki-S
Created March 23, 2014 04:38
Show Gist options
  • Save Genki-S/9718868 to your computer and use it in GitHub Desktop.
Save Genki-S/9718868 to your computer and use it in GitHub Desktop.
#!/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