From 459b197373a9758309fe795025f903447e77092e Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 17 Apr 2017 05:21:16 +0300 Subject: branch_eol_normalized: bugfix --- %HOME%/.bash_utils/git.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/%HOME%/.bash_utils/git.sh b/%HOME%/.bash_utils/git.sh index c99f2e2..9f829e2 100644 --- a/%HOME%/.bash_utils/git.sh +++ b/%HOME%/.bash_utils/git.sh @@ -32,6 +32,8 @@ branch_eol_normalized() ( return 1 fi + local normalized=0 + local line while IFS= read -d '' -r line; do local eolinfo @@ -46,10 +48,18 @@ branch_eol_normalized() ( return 1 fi - if [ "$eolinfo" == crlf ] || [ "$eolinfo" == mixed ]; then - echo "${FUNCNAME[0]}: detected inconsistent line endings in file: $path" >&2 + if [ "$eolinfo" == crlf ]; then + echo "${FUNCNAME[0]}: CRLF line endings in file: $path" >&2 + elif [ "$eolinfo" == mixed ]; then + echo "${FUNCNAME[0]}: mixed line endings in file: $path" >&2 + else + continue fi + + normalized=1 done < <( git ls-files -z --eol ) + + return "$normalized" ) repo_eol_normalized() ( -- cgit v1.2.3