aboutsummaryrefslogtreecommitdiffhomepage
path: root/hooks/pre-commit
blob: 44010fa1a0553ab1655886607c63985879920829 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

#check the config, in case the user really wants to allow tabs...
allowtabs=$(git config hooks.allowtabs)
if [ "$allowtabs" != "true" ] &&
   git diff --cached | egrep '^\+.*	'
then
   cat<<END;
Error: This commit would contain a tab, which is against this repo's policy.
END
  exit 1
fi

# If there are whitespace errors, print the offending file names and fail.
if
# Use git built-in checks for trailing whitespaces
    ! git diff --check --cached
then
   cat<<END;
Error: This commit would contain trailing spaces, which is against this repo's policy.
END
  exit 1
fi