Skip to content

Instantly share code, notes, and snippets.

@tknhs
Last active May 17, 2020 17:39
Show Gist options
  • Save tknhs/78fead338f4e2503038e18830663ae5e to your computer and use it in GitHub Desktop.
Save tknhs/78fead338f4e2503038e18830663ae5e to your computer and use it in GitHub Desktop.
拡張子.mqh がバイナリファイルとして扱われることを防ぐために .git/hooks/pre-commit でコミットしていいかチェックする
#!/bin/bash
ok=true
for file in $(git diff --name-only --cached | grep .mqh); do
if [ "`nkf --guess $file | grep 'Shift_JIS'`" ]; then
:
else
ok=false
echo "$file is not Shift_JIS"
fi
done
if [ !$ok ]; then
echo "execute: nkf -s --overwrite *.mqh"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment