Skip to content
Browse files make it not touch unmodified files
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 3f330aa6674dfe44d1e82e938ebf0e83c69dc6e1
Showing 1 changed file with 10 additions and 2 deletions.
@@ -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
@@ -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.