Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2813 from rouault/avoid_astyle_writing_unmodified…
…_files

astyle.sh: make it not touch unmodified files
  • Loading branch information
jef-n committed Feb 19, 2016
2 parents 1e80a98 + ec0be3c commit 07240e3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/astyle.sh
Expand Up @@ -56,7 +56,11 @@ set -e

astyleit() {
$ASTYLE --options="$ASTYLEOPTS" "$1"
scripts/unify_includes.pl "$1"
modified=$1.unify_includes_modified
cp "$1" "$modified"
scripts/unify_includes.pl "$modified"
diff "$1" "$modified" >/dev/null || mv "$modified" "$1"
rm -f "$modified"
}

for f in "$@"; do
Expand Down Expand Up @@ -103,6 +107,10 @@ for f in "$@"; do
echo "removed BOM from $f"
fi

flip -ub "$f"
modified=$f.flip_modified
cp "$f" "$modified"
flip -ub "$modified"
diff "$f" "$modified" >/dev/null || mv "$modified" "$f"
rm -f "$modified"
eval "$cmd '$f'"
done

0 comments on commit 07240e3

Please sign in to comment.