Skip to content


Permalink make it not touch unmodified files
Browse files Browse the repository at this point in the history
Currently will rewrite files, even if no change are made.
This causes some editors (for example kate) to believe that the file
has been changed even if it is not the case. Letting the timestamp
untouched is not enough. So make 'flip' and ''
operate on copies, and move the copies as the original file if
differences are found.
  • Loading branch information
rouault committed Feb 19, 2016
1 parent 30a738f commit 3f330aa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ set -e

astyleit() {
$ASTYLE --options="$ASTYLEOPTS" "$1"
scripts/ "$1"
cp "$1" "$modified"
scripts/ "$modified"
diff "$f" "$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"

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

0 comments on commit 3f330aa

Please sign in to comment.