fix: try to update ref head only if remote has diverged
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
Description
If the remote has diverged from the local branches, glab mr checkout will fail.
the cause is during checkout, the cli invokes git fetch git@gitlab.com/xxx/yyy.git refs/heads/branchA:branchA trying to update the local ref to the remote.
but this happens if the remote has diverged
! [rejected] branchA -> branchA (non-fast-forward)
the proposed change retries git fetch git@gitlab.com/xxx/yyy.git refs/heads/branchA that only update the ref head without updating the branch head and leave the user to resolve the divergence between the remote and local branches
Related Issues
Resolves #7863 (closed)
How has this been tested?
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap
Edited by braineo