Our documentation states that three kinds of values are possible for ref option.
From v4.0.0, we started checking out to FETCH_HEAD instead of CHECKOUT_REF (reference)
This is okay when ref is a commit or tag. Because both are readonly and a user using them in their builds don't intend to do a git push in those cases. But when a ref is pointing to a branch name, then the user might be intending to do a git push to that branch at some point in their build. Using the FETCH_HEAD instead of CHECKOUT_REF causes the repo to be in detached HEAD state which will not allow a git push. This PR addresses this particular regression when ref is pointing to a branch name.
Our documentation states that three kinds of values are possible for
ref
option.From
v4.0.0
, we started checking out to FETCH_HEAD instead of CHECKOUT_REF (reference)This is okay when
ref
is a commit or tag. Because both are readonly and a user using them in their builds don't intend to do agit push
in those cases. But when aref
is pointing to a branch name, then the user might be intending to do agit push
to that branch at some point in their build. Using the FETCH_HEAD instead of CHECKOUT_REF causes the repo to be in detached HEAD state which will not allow a git push. This PR addresses this particular regression whenref
is pointing to a branch name.