Updates to reformat script.
Don't change files if they're unmodified. Indicate which files have changed and a summary. Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
parent
5496cd3e5d
commit
f0983d3953
@ -30,6 +30,7 @@ VERBOSE=false
|
|||||||
DONT=false
|
DONT=false
|
||||||
STOPARGS=false
|
STOPARGS=false
|
||||||
COMMENTS=false
|
COMMENTS=false
|
||||||
|
CHANGED=false
|
||||||
DEBUG=""
|
DEBUG=""
|
||||||
|
|
||||||
# for this exercise, we want to force the openssl style, so we roll
|
# for this exercise, we want to force the openssl style, so we roll
|
||||||
@ -82,10 +83,6 @@ do
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$VERBOSE" = "true" ]; then
|
|
||||||
echo "$j"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DONT" = "false" ]; then
|
if [ "$DONT" = "false" ]; then
|
||||||
tmp=$(mktemp /tmp/indent.XXXXXX)
|
tmp=$(mktemp /tmp/indent.XXXXXX)
|
||||||
trap 'rm -f "$tmp"' HUP INT TERM EXIT
|
trap 'rm -f "$tmp"' HUP INT TERM EXIT
|
||||||
@ -138,7 +135,18 @@ do
|
|||||||
else
|
else
|
||||||
expand "$j" | indent $INDENT_ARGS > "$tmp"
|
expand "$j" | indent $INDENT_ARGS > "$tmp"
|
||||||
fi;
|
fi;
|
||||||
mv "$tmp" "$j"
|
if cmp -s "$tmp" "$j"; then
|
||||||
|
if [ "$VERBOSE" = "true" ]; then
|
||||||
|
echo "$j unchanged"
|
||||||
|
fi
|
||||||
|
rm "$tmp"
|
||||||
|
else
|
||||||
|
if [ "$VERBOSE" = "true" ]; then
|
||||||
|
echo "$j changed"
|
||||||
|
fi
|
||||||
|
CHANGED=true
|
||||||
|
mv "$tmp" "$j"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -146,3 +154,11 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$VERBOSE" = "true" ]; then
|
||||||
|
echo
|
||||||
|
if [ "$CHANGED" = "true" ]; then
|
||||||
|
echo "SOURCE WAS MODIFIED"
|
||||||
|
else
|
||||||
|
echo "SOURCE WAS NOT MODIFIED"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user