]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
GitHooks for checking trailing whitespaces. End of lines are controlled by Git now.
authorazv <azv@opencascade.com>
Tue, 27 Dec 2016 12:00:53 +0000 (15:00 +0300)
committerazv <azv@opencascade.com>
Wed, 28 Dec 2016 04:21:20 +0000 (07:21 +0300)
GitHooks/pre-commit.in

index 52e778fdf80f80972af4f466a63b411b6e92c5d1..9f1f96032ee17679a35ab35b9a366528343b53b8 100644 (file)
@@ -1,11 +1,5 @@
 #!/bin/bash
 
-function isDOSFile
-{
-  local FILENAME="$1"
-  file "$FILENAME" | grep -q "CRLF line terminators"
-}
-
 if git rev-parse --verify HEAD >/dev/null 2>&1
 then
   against=HEAD
@@ -44,21 +38,5 @@ EOF
   exit 1
 fi
 
-FOUND=0
 # If there are whitespace errors, print the offending file names and fail.
-if [ "$(exec git diff-index --check --cached $against -- )" != "" ]
-then
-  FOUND=1
-fi
-
-# Find files with DOS line endings
-for FILE in $(exec git diff --name-only --cached $against -- | sed '/^[+-]/d' | sed -r 's/:[0-9]+:.*//' | uniq) ; do
-  isDOSFile "$FILE"
-  if (( $? == 0 ))
-  then
-    echo "ERROR: \"$FILE\" has DOS line endings" >&2
-    FOUND=1
-  fi
-done
-
-exit $FOUND
+exec git diff-index --check --cached $against --