From: azv Date: Tue, 27 Dec 2016 12:00:53 +0000 (+0300) Subject: GitHooks for checking trailing whitespaces. End of lines are controlled by Git now. X-Git-Tag: V_2.7.0~351^2~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9d4534592975d8e69f423e5f2e7d3bacee05a0db;p=modules%2Fshaper.git GitHooks for checking trailing whitespaces. End of lines are controlled by Git now. --- diff --git a/GitHooks/pre-commit.in b/GitHooks/pre-commit.in index 52e778fdf..9f1f96032 100644 --- a/GitHooks/pre-commit.in +++ b/GitHooks/pre-commit.in @@ -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 --