From f87685394808b6fd95adf29a37934458137562b7 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 24 Jul 2013 12:55:06 +0000 Subject: [PATCH] build: automatically add svn:eol-style = RF property to source files. --- build/check-source.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build/check-source.sh b/build/check-source.sh index 46eeaf3d..39302a8d 100755 --- a/build/check-source.sh +++ b/build/check-source.sh @@ -84,6 +84,7 @@ fi total_crlfs=0 total_spaces=0 total_tabs=0 +total_props=0 OIFS="$IFS" IFS=' @@ -105,12 +106,14 @@ total_errors=0 for file in $FILES; do should_check_crlf=false should_check_spaces=false + should_check_props=false case "$file" in # These files we know how to handle *.c|*.cpp|*.m|*.mm|*.h|*.hh|*.lolfx|*.lua|*.l|*.y|*.sh|*.py) should_check_crlf=true should_check_spaces=true + should_check_props=true ;; *) continue @@ -155,6 +158,20 @@ for file in $FILES; do 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 if [ "$should_check_spaces" = true ]; then 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_spaces trailing whitespaces - replaced $total_tabs tabs with spaces + - fixed $total_props svn:eol-style properties EOF elif [ "$fix" = "true" ]; then # OR: report in stdout @@ -212,6 +230,9 @@ EOF if [ "$total_tabs" -gt 0 ]; then info " - fixed $total_tabs tabs" fi + if [ "$total_props" -gt 0 ]; then + info " - fixed $total_props svn:eol-style properties" + fi info "re-run with -c to commit fixes" else # OR: warn about how to fix errors