From 85183a702ab342de03d7a8d7b73e1fb0f7e346f2 Mon Sep 17 00:00:00 2001 From: Lectem Date: Sun, 31 May 2015 13:24:23 +0200 Subject: force no-tab/trailing spaces with git hook Remove unneeded stuff from pre-commit script The check against an empty commit was not needed (it is only a security for the 1st commit after git init). It could also possibly pose problems because of the redirection to /dev/null on some windows systems. newline at EOF & fixed indent --- hooks/pre-commit | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 hooks/pre-commit (limited to 'hooks') diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100644 index 00000000..44010fa1 --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,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<