diff options
-rw-r--r-- | %HOME%/.bash_utils/git.sh | 14 |
1 files 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() ( |