| @@ -84,6 +84,7 @@ fi | |||||
| total_crlfs=0 | total_crlfs=0 | ||||
| total_spaces=0 | total_spaces=0 | ||||
| total_tabs=0 | total_tabs=0 | ||||
| total_props=0 | |||||
| OIFS="$IFS" | OIFS="$IFS" | ||||
| IFS=' | IFS=' | ||||
| @@ -105,12 +106,14 @@ total_errors=0 | |||||
| for file in $FILES; do | for file in $FILES; do | ||||
| should_check_crlf=false | should_check_crlf=false | ||||
| should_check_spaces=false | should_check_spaces=false | ||||
| should_check_props=false | |||||
| case "$file" in | case "$file" in | ||||
| # These files we know how to handle | # These files we know how to handle | ||||
| *.c|*.cpp|*.m|*.mm|*.h|*.hh|*.lolfx|*.lua|*.l|*.y|*.sh|*.py) | *.c|*.cpp|*.m|*.mm|*.h|*.hh|*.lolfx|*.lua|*.l|*.y|*.sh|*.py) | ||||
| should_check_crlf=true | should_check_crlf=true | ||||
| should_check_spaces=true | should_check_spaces=true | ||||
| should_check_props=true | |||||
| ;; | ;; | ||||
| *) | *) | ||||
| continue | continue | ||||
| @@ -155,6 +158,20 @@ for file in $FILES; do | |||||
| fi | fi | ||||
| fi | fi | ||||
| # Check for CR LF SVN prop | |||||
| if [ "$repo" = svn -a "$should_check_props" = true ]; then | |||||
| if [ "$(svn propget svn:eol-style "$file")" != "CR" ]; then | |||||
| clean=false | |||||
| if [ "$fix" = true ]; then | |||||
| svn propset svn:eol-style CR "$file" | |||||
| info "$file is missing svn:eol-style property" | |||||
| else | |||||
| error "$file is missing svn:eol-style property" | |||||
| fi | |||||
| total_props="$(($total_props + 1))" | |||||
| fi | |||||
| fi | |||||
| # Check for trailing spaces | # Check for trailing spaces | ||||
| if [ "$should_check_spaces" = true ]; then | if [ "$should_check_spaces" = true ]; then | ||||
| nspaces="$($SED 's/.*[^ \t]//' "$file" | tr -cd '\t ' | wc -c)" | nspaces="$($SED 's/.*[^ \t]//' "$file" | tr -cd '\t ' | wc -c)" | ||||
| @@ -199,6 +216,7 @@ fixed $total_errors files out of $total_files: | |||||
| - removed $total_crlfs CR characters | - removed $total_crlfs CR characters | ||||
| - removed $total_spaces trailing whitespaces | - removed $total_spaces trailing whitespaces | ||||
| - replaced $total_tabs tabs with spaces | - replaced $total_tabs tabs with spaces | ||||
| - fixed $total_props svn:eol-style properties | |||||
| EOF | EOF | ||||
| elif [ "$fix" = "true" ]; then | elif [ "$fix" = "true" ]; then | ||||
| # OR: report in stdout | # OR: report in stdout | ||||
| @@ -212,6 +230,9 @@ EOF | |||||
| if [ "$total_tabs" -gt 0 ]; then | if [ "$total_tabs" -gt 0 ]; then | ||||
| info " - fixed $total_tabs tabs" | info " - fixed $total_tabs tabs" | ||||
| fi | fi | ||||
| if [ "$total_props" -gt 0 ]; then | |||||
| info " - fixed $total_props svn:eol-style properties" | |||||
| fi | |||||
| info "re-run with -c to commit fixes" | info "re-run with -c to commit fixes" | ||||
| else | else | ||||
| # OR: warn about how to fix errors | # OR: warn about how to fix errors | ||||