Mercurial > lasercutter
diff graster/hacklab-engraver/.git/hooks/pre-commit.sample @ 11:f952052e37b7
trying a fix.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 24 Aug 2010 19:06:45 -0400 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/graster/hacklab-engraver/.git/hooks/pre-commit.sample Tue Aug 24 19:06:45 2010 -0400 1.3 @@ -0,0 +1,46 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +# An example hook script to verify what is about to be committed. 1.7 +# Called by git-commit with no arguments. The hook should 1.8 +# exit with non-zero status after issuing an appropriate message if 1.9 +# it wants to stop the commit. 1.10 +# 1.11 +# To enable this hook, rename this file to "pre-commit". 1.12 + 1.13 +if git-rev-parse --verify HEAD >/dev/null 2>&1 1.14 +then 1.15 + against=HEAD 1.16 +else 1.17 + # Initial commit: diff against an empty tree object 1.18 + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 1.19 +fi 1.20 + 1.21 +# If you want to allow non-ascii filenames set this variable to true. 1.22 +allownonascii=$(git config hooks.allownonascii) 1.23 + 1.24 +# Cross platform projects tend to avoid non-ascii filenames; prevent 1.25 +# them from being added to the repository. We exploit the fact that the 1.26 +# printable range starts at the space character and ends with tilde. 1.27 +if [ "$allownonascii" != "true" ] && 1.28 + # Note that the use of brackets around a tr range is ok here, (it's 1.29 + # even required, for portability to Solaris 10's /usr/bin/tr), since 1.30 + # the square bracket bytes happen to fall in the designated range. 1.31 + test "$(git diff --cached --name-only --diff-filter=A -z $against | 1.32 + LC_ALL=C tr -d '[ -~]\0')" 1.33 +then 1.34 + echo "Error: Attempt to add a non-ascii file name." 1.35 + echo 1.36 + echo "This can cause problems if you want to work" 1.37 + echo "with people on other platforms." 1.38 + echo 1.39 + echo "To be portable it is advisable to rename the file ..." 1.40 + echo 1.41 + echo "If you know what you are doing you can disable this" 1.42 + echo "check using:" 1.43 + echo 1.44 + echo " git config hooks.allownonascii true" 1.45 + echo 1.46 + exit 1 1.47 +fi 1.48 + 1.49 +exec git diff-index --check --cached $against --