diff options
author | Sam Clegg <sbc@chromium.org> | 2021-03-22 11:57:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-22 11:57:17 -0700 |
commit | 5c17d353ce24dffabf05d7fd2bf9d20a3618962f (patch) | |
tree | 73332383fd820776a62c72103ec64034bbc489fe | |
parent | 6856f261d78ba245b0f6364ad4683778e022b5d2 (diff) | |
download | binaryen-5c17d353ce24dffabf05d7fd2bf9d20a3618962f.tar.gz binaryen-5c17d353ce24dffabf05d7fd2bf9d20a3618962f.tar.bz2 binaryen-5c17d353ce24dffabf05d7fd2bf9d20a3618962f.zip |
Allow clang-format-diff/clang-tidy-diff to take branch as argument (#3711)
Also update clang-format-diff.sh to match recent changes to branch
name and CI system (these changes mirror those already made to
clang-tidy-diff.sh).
-rwxr-xr-x | scripts/clang-format-diff.sh | 15 | ||||
-rwxr-xr-x | scripts/clang-tidy-diff.sh | 4 |
2 files changed, 8 insertions, 11 deletions
diff --git a/scripts/clang-format-diff.sh b/scripts/clang-format-diff.sh index c1f1885b7..01a813f2b 100755 --- a/scripts/clang-format-diff.sh +++ b/scripts/clang-format-diff.sh @@ -3,17 +3,12 @@ set -o errexit set -o pipefail -# When we are running on travis and *not* part of a pull request we don't -# have any upstream branch to compare against. -if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then - echo "Skipping since not running on travis PR" - exit 0 -fi - -if [ -n "$TRAVIS_BRANCH" ]; then - BRANCH=$TRAVIS_BRANCH +if [ -n "$1" ]; then + BRANCH="$1" +elif [ -n "$GITHUB_BASE_REF" ]; then + BRANCH="origin/$GITHUB_BASE_REF" else - BRANCH=origin/main + BRANCH="@{upstream}" fi MERGE_BASE=$(git merge-base $BRANCH HEAD) diff --git a/scripts/clang-tidy-diff.sh b/scripts/clang-tidy-diff.sh index 230764abe..9afe1824e 100755 --- a/scripts/clang-tidy-diff.sh +++ b/scripts/clang-tidy-diff.sh @@ -3,7 +3,9 @@ set -o errexit set -o pipefail -if [ -n "$GITHUB_BASE_REF" ]; then +if [ -n "$1" ]; then + BRANCH="$1" +elif [ -n "$GITHUB_BASE_REF" ]; then BRANCH="origin/$GITHUB_BASE_REF" else BRANCH="@{upstream}" |