OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 self="$0" | 2 self="$0" |
3 dirname_self=$(dirname "$self") | 3 dirname_self=$(dirname "$self") |
4 | 4 |
5 usage() { | 5 usage() { |
6 cat <<EOF >&2 | 6 cat <<EOF >&2 |
7 Usage: $self [option] | 7 Usage: $self [option] |
8 | 8 |
9 This script applies a whitespace transformation to the commit at HEAD. If no | 9 This script applies a whitespace transformation to the commit at HEAD. If no |
10 options are given, then the modified files are left in the working tree. | 10 options are given, then the modified files are left in the working tree. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 # Need to be in the root | 116 # Need to be in the root |
117 cd "$(git rev-parse --show-toplevel)" | 117 cd "$(git rev-parse --show-toplevel)" |
118 | 118 |
119 # Collect the original diff | 119 # Collect the original diff |
120 git show > "${ORIG_DIFF}" | 120 git show > "${ORIG_DIFF}" |
121 | 121 |
122 # Apply the style guide on new and modified files and collect its diff | 122 # Apply the style guide on new and modified files and collect its diff |
123 for f in $(git diff HEAD^ --name-only -M90 --diff-filter=AM); do | 123 for f in $(git diff HEAD^ --name-only -M90 --diff-filter=AM); do |
124 case "$f" in | 124 case "$f" in |
125 third_party/*) continue;; | 125 third_party/*) continue;; |
126 nestegg/*) continue;; | |
127 esac | 126 esac |
128 vpx_style "$f" | 127 vpx_style "$f" |
129 done | 128 done |
130 git diff --no-color --no-ext-diff > "${MODIFIED_DIFF}" | 129 git diff --no-color --no-ext-diff > "${MODIFIED_DIFF}" |
131 | 130 |
132 # Intersect the two diffs | 131 # Intersect the two diffs |
133 "${dirname_self}"/intersect-diffs.py \ | 132 "${dirname_self}"/intersect-diffs.py \ |
134 "${ORIG_DIFF}" "${MODIFIED_DIFF}" > "${FINAL_DIFF}" | 133 "${ORIG_DIFF}" "${MODIFIED_DIFF}" > "${FINAL_DIFF}" |
135 INTERSECT_RESULT=$? | 134 INTERSECT_RESULT=$? |
136 git reset --hard >/dev/null | 135 git reset --hard >/dev/null |
(...skipping 14 matching lines...) Expand all Loading... |
151 else | 150 else |
152 apply "${FINAL_DIFF}" | 151 apply "${FINAL_DIFF}" |
153 if ! git diff --quiet; then | 152 if ! git diff --quiet; then |
154 log "Formatting changes applied, verify and commit." | 153 log "Formatting changes applied, verify and commit." |
155 log "See also: http://www.webmproject.org/code/contribute/conventions/" | 154 log "See also: http://www.webmproject.org/code/contribute/conventions/" |
156 git diff --stat | 155 git diff --stat |
157 fi | 156 fi |
158 fi | 157 fi |
159 | 158 |
160 rm -f ${CLEAN_FILES} | 159 rm -f ${CLEAN_FILES} |
OLD | NEW |