diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-17 05:21:16 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-17 05:21:16 +0300 |
commit | 459b197373a9758309fe795025f903447e77092e (patch) | |
tree | dd91fd239f672a1719a031b82611b0bb3c1422ae /%HOME% | |
parent | str_join: echo instead of printf (diff) | |
download | linux-home-459b197373a9758309fe795025f903447e77092e.tar.gz linux-home-459b197373a9758309fe795025f903447e77092e.zip |
branch_eol_normalized: bugfix
Diffstat (limited to '')
-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() ( |