diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-02-01 14:51:46 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-02-04 19:03:44 +0000 |
commit | f0983d3953fdc3e162e97ae4d35086e687aa4c89 (patch) | |
tree | e479467d2232ce86a13d2bb20ee25be2f737fb23 /util | |
parent | 5496cd3e5d9a0ab4c1235bdda9872eeb5ec130bb (diff) |
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>
Diffstat (limited to 'util')
-rwxr-xr-x | util/openssl-format-source | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/util/openssl-format-source b/util/openssl-format-source index 4e90147434..6380a100b4 100755 --- a/util/openssl-format-source +++ b/util/openssl-format-source @@ -30,6 +30,7 @@ VERBOSE=false DONT=false STOPARGS=false COMMENTS=false +CHANGED=false DEBUG="" # for this exercise, we want to force the openssl style, so we roll @@ -82,10 +83,6 @@ do fi fi - if [ "$VERBOSE" = "true" ]; then - echo "$j" - fi - if [ "$DONT" = "false" ]; then tmp=$(mktemp /tmp/indent.XXXXXX) trap 'rm -f "$tmp"' HUP INT TERM EXIT @@ -138,7 +135,18 @@ do else expand "$j" | indent $INDENT_ARGS > "$tmp" 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 fi @@ -146,3 +154,11 @@ do done +if [ "$VERBOSE" = "true" ]; then + echo + if [ "$CHANGED" = "true" ]; then + echo "SOURCE WAS MODIFIED" + else + echo "SOURCE WAS NOT MODIFIED" + fi +fi |