| # Copyright lowRISC contributors. |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| # A wrapper around fix_whitespace.py, used for CI. |
| # Expects a single argument, which is the pull request's target branch |
| echo >&2 "Usage: whitespace.sh <tgt-branch>" |
| merge_base="$(git merge-base origin/$tgt_branch HEAD)" || { |
| echo >&2 "Failed to find fork point for origin/$tgt_branch." |
| echo "Checking whitespace on files changed since $merge_base" |
| git diff --name-only --diff-filter=ACMRTUXB "$merge_base" -- \ |
| ':!third_party/rust/crates/*' \ |
| xargs -r util/fix_trailing_whitespace.py --dry-run || { |
| echo -n "##vso[task.logissue type=error]" |
| echo "Whitespace check failed. Please run util/fix_trailing_whitespace.py on the above files." |