mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
fixing pre-commit hook when no c or scheme files are changed
This commit is contained in:
parent
e70ebc4f35
commit
a3d0d7a49c
1 changed files with 4 additions and 3 deletions
|
@ -8,16 +8,17 @@ else
|
|||
fi
|
||||
|
||||
# fail if we add any new lines to C or Scheme source containing a tab
|
||||
if git diff --name-only "$against" |\
|
||||
if git diff --name-only "$against" | egrep -q '\.(cpp|h|scm|sld|stub)$' &&\
|
||||
git diff --name-only "$against" |\
|
||||
egrep '\.(cpp|h|scm|sld|stub)$' |\
|
||||
xargs -d'\n' git diff -U0 --no-color "$against" -- |\
|
||||
xargs -d'\n' git diff -U0 --no-color "$against" -- |\
|
||||
grep -q $'^+ *\t'; then
|
||||
echo "Error: Attempting to add a source file using tabs for indentation."
|
||||
echo
|
||||
echo -n " "
|
||||
git diff --name-only "$against" |\
|
||||
egrep '\.(cpp|h|scm|sld|stub)$' |\
|
||||
xargs -d'\n' git diff -U0 "$against" -- |\
|
||||
xargs -d'\n' git diff -U0 "$against" -- |\
|
||||
grep $'^+ *\t' | head -1
|
||||
echo
|
||||
cat <<EOF
|
||||
|
|
Loading…
Add table
Reference in a new issue