From 9d4534592975d8e69f423e5f2e7d3bacee05a0db Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 27 Dec 2016 15:00:53 +0300 Subject: [PATCH] GitHooks for checking trailing whitespaces. End of lines are controlled by Git now. --- GitHooks/pre-commit.in | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) 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 -- -- 2.39.2