Skip to content

Commit

Permalink
se --verify --quiet with rev-parse for old commit targeting
Browse files Browse the repository at this point in the history
  • Loading branch information
radhermit committed Nov 29, 2024
1 parent 5a5aa6a commit 82810e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkgcruft-action
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ set +e
# determine old commit for diff targeting
if [[ -n ${GIT_BASE_BRANCH} ]]; then
# pull request
OLD_COMMIT=$(git rev-parse origin/${GIT_BASE_BRANCH})
OLD_COMMIT=$(git rev-parse --verify --quiet origin/${GIT_BASE_BRANCH})
OLD_COMMIT_NAME=origin/${GIT_BASE_BRANCH}
elif [[ ${GIT_BRANCH} != ${GIT_DEFAULT_BRANCH} ]]; then
# non-default branch
OLD_COMMIT=$(git rev-parse origin/${GIT_DEFAULT_BRANCH})
OLD_COMMIT=$(git rev-parse --verify --quiet origin/${GIT_DEFAULT_BRANCH})
OLD_COMMIT_NAME=origin/${GIT_DEFAULT_BRANCH}
else
OLD_COMMIT=$(git rev-parse HEAD~1)
OLD_COMMIT_NAME=$(git rev-parse --short HEAD~1)
OLD_COMMIT=$(git rev-parse --verify --quiet HEAD~1)
OLD_COMMIT_NAME=$(git rev-parse --short --verify --quiet HEAD~1)
fi

# disable diff support if the target commits don't exist due a shallow git checkout
Expand Down

0 comments on commit 82810e6

Please sign in to comment.