Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions sdks/java/build-tools/beam-linkage-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ if [ ! -z "$(git diff)" ]; then
exit 1
fi

STARTING_REF=$(git rev-parse --abbrev-ref HEAD)
# Use the full commit SHA instead of branch name to handle detached HEAD state.
# This commonly happens when verifying someone else's PR, which involves
# merging two non-branch references. See https://github.com/apache/beam/issues/20558
STARTING_REF=$(git rev-parse HEAD)
function cleanup() {
git checkout $STARTING_REF
git -c advice.detachedHead=false checkout $STARTING_REF
}
trap cleanup EXIT

Expand Down
Loading