Skip to content

Commit

Permalink
Allow BUILDKITE_BRANCH to provide branch name (#46053)
Browse files Browse the repository at this point in the history
* Allow `BUILDKITE_BRANCH` to provide branch name

Our CI system checks commits out as a detached head, which breaks our
`Base.GIT_VERSION_INFO.branch` information.

* Fix typo
  • Loading branch information
staticfloat committed Jul 15, 2022
1 parent c7e2f9b commit d117975
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion base/version_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ if [ -n "$(git status --porcelain)" ]; then
# append dirty mark '*' if the repository has uncommitted changes
commit_short="$commit_short"*
fi
branch=$(git rev-parse --abbrev-ref HEAD)

# Our CI system checks commits out as a detached head, and so we must
# use the provided branch name, as we cannot autodetect this commit as
# the tip of any such branch.
if [ -n "${BUILDKITE_BRANCH}" ]; then
branch="${BUILDKITE_BRANCH}"
else
branch=$(git rev-parse --abbrev-ref HEAD)
fi

topdir=$(git rev-parse --show-toplevel)
verchanged=$(git blame -L ,1 -sl -- "$topdir/VERSION" | cut -f 1 -d " ")
Expand Down

0 comments on commit d117975

Please sign in to comment.