Bladeren bron

build: automatically add svn:eol-style = RF property to source files.

legacy
Sam Hocevar sam 11 jaren geleden
bovenliggende
commit
f876853948
1 gewijzigde bestanden met toevoegingen van 21 en 0 verwijderingen
  1. +21
    -0
      build/check-source.sh

+ 21
- 0
build/check-source.sh Bestand weergeven

@@ -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


Laden…
Annuleren
Opslaan