diff options
author | Maxime Dénès <mail@maximedenes.fr> | 2018-02-28 10:05:35 +0100 |
---|---|---|
committer | Maxime Dénès <mail@maximedenes.fr> | 2018-02-28 10:05:35 +0100 |
commit | 5213bcdfd2baa5e2e652eaa63fff8d3268959489 (patch) | |
tree | b2eee60485610d9bb0e8dff44f94ad85c693b0e5 /dev | |
parent | db6d0bbf0a881b8867f3411acbedcba5c946c8f8 (diff) | |
parent | 6ef5c101facffc902577519bcfb0ffdcbe1be166 (diff) |
Merge PR #6789: Check whitespace errors per-commit.
Diffstat (limited to 'dev')
-rwxr-xr-x | dev/lint-commits.sh | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/dev/lint-commits.sh b/dev/lint-commits.sh index eb12bc227..d8043558e 100755 --- a/dev/lint-commits.sh +++ b/dev/lint-commits.sh @@ -19,14 +19,21 @@ fi BASE_COMMIT="$1" HEAD_COMMIT="$2" -# git diff --check -# uses .gitattributes to know what to check -if git diff --check "$BASE_COMMIT" "$HEAD_COMMIT"; +bad=() +while IFS= read -r commit; do + echo Checking "$commit" + # git diff --check + # uses .gitattributes to know what to check + if ! git diff --check "${commit}^" "$commit"; + then + bad+=("$commit") + fi +done < <(git rev-list "$HEAD_COMMIT" --not "$BASE_COMMIT" --) + +if [ "${#bad[@]}" != 0 ] then - : -else >&2 echo "Whitespace errors!" - >&2 echo "Running 'git diff --check $BASE_COMMIT $HEAD_COMMIT'." + >&2 echo "In commits ${bad[*]}" >&2 echo "If you use emacs, you can prevent this kind of error from reocurring by installing ws-butler and enabling ws-butler-convert-leading-tabs-or-spaces." exit 1 fi |