mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
fix pre-commit diff reference
This commit is contained in:
parent
ed4ecd4dca
commit
d22959a40e
1 changed files with 13 additions and 3 deletions
|
@ -1,13 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||||
|
against=HEAD
|
||||||
|
else
|
||||||
|
# Initial commit: diff against an empty tree object
|
||||||
|
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||||
|
fi
|
||||||
|
|
||||||
# fail if we add any new lines to C or Scheme source containing a tab
|
# fail if we add any new lines to C or Scheme source containing a tab
|
||||||
if git diff --name-only | egrep '\.(cpp|h|scm|sld|stub)$' | xargs -d'\n' git diff -U0 -- | grep -q $'^+ *\t'; then
|
if git diff --name-only "$against" |\
|
||||||
|
egrep '\.(cpp|h|scm|sld|stub)$' |\
|
||||||
|
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 "Error: Attempting to add a source file using tabs for indentation."
|
||||||
echo
|
echo
|
||||||
echo -n " "
|
echo -n " "
|
||||||
git diff --name-only |\
|
git diff --name-only "$against" |\
|
||||||
egrep '\.(cpp|h|scm|sld|stub)$' |\
|
egrep '\.(cpp|h|scm|sld|stub)$' |\
|
||||||
xargs -d'\n' git diff -U0 -- |\
|
xargs -d'\n' git diff -U0 "$against" -- |\
|
||||||
grep $'^+ *\t' | head -1
|
grep $'^+ *\t' | head -1
|
||||||
echo
|
echo
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
Loading…
Add table
Reference in a new issue