verify-indentation.sh: fix for pull request from bar/master to foo/master

This commit is contained in:
Even Rouault 2021-09-15 13:21:25 +02:00
parent fd485f2f13
commit 29818b8e92
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D
1 changed files with 3 additions and 5 deletions

View File

@ -21,11 +21,9 @@ ASTYLEDIFF=/tmp/astyle.diff
if [ ! -z $GITHUB_BASE_REF ] && [ ! -z $GITHUB_HEAD_REF ]; then if [ ! -z $GITHUB_BASE_REF ] && [ ! -z $GITHUB_HEAD_REF ]; then
# on a PR # on a PR
echo "GitHub PR COMMIT RANGE: ${GITHUB_BASE_REF}..${GITHUB_HEAD_REF}" echo "GitHub PR COMMIT RANGE: ${GITHUB_BASE_REF}..${GITHUB_HEAD_REF}"
git branch ${GITHUB_BASE_REF} origin/${GITHUB_BASE_REF} git branch tmp_${GITHUB_BASE_REF} origin/${GITHUB_BASE_REF}
git branch ${GITHUB_HEAD_REF} origin/${GITHUB_HEAD_REF} BASE_SHA1=$(git rev-parse tmp_${GITHUB_BASE_REF})
BASE_SHA1=$(git rev-parse ${GITHUB_BASE_REF}) FILES=$(git diff --diff-filter=AMR --name-only ${BASE_SHA1}..${GITHUB_SHA} | tr '\n' ' ' )
HEAD_SHA1=$(git rev-parse ${GITHUB_HEAD_REF})
FILES=$(git diff --diff-filter=AMR --name-only ${BASE_SHA1}..${HEAD_SHA1} | tr '\n' ' ' )
elif [ ! -z $GITHUB_SHA ]; then elif [ ! -z $GITHUB_SHA ]; then
echo "GitHub push COMMIT $GITHUB_SHA" echo "GitHub push COMMIT $GITHUB_SHA"
FILES=$(git diff --diff-filter=AMR --name-only ${GITHUB_SHA}~1..${GITHUB_SHA} | tr '\n' ' ' ) FILES=$(git diff --diff-filter=AMR --name-only ${GITHUB_SHA}~1..${GITHUB_SHA} | tr '\n' ' ' )