Skip to content

Display an error when repository has an ambiguous head branch

Vasilii Iakliushin requested to merge 381731_warn_user_about_head_branch into master

What does this MR do and why?

Contributes to #381731 (closed)

Problem

User cannot change the default branch when the repository has an ambiguous head branch. We show a successful message to the user.

More details

Before git version 2.16.0 users could create a branch named HEAD that collides with internal HEAD reference. It causes an ambiguity that blocks users from updating the default branch of the repository.

This bug was fixed in git via this commit. But some old repositories can still contain a stale HEAD branch.

How to fix

  1. Go to the repository -> branches (https://gitlab.com/gitlab-org/gitlab/-/branches)
  2. Search for branch named HEAD (https://gitlab.com/gitlab-org/gitlab/-/branches?state=all&search=%5EHEAD)
  3. Verify that the branch does not contain any uncommitted changes and delete it

Solution

Display an error with a hint what can be wrong.

Screenshots or screen recordings

Screenshot_2022-12-02_at_16.34.34

How to set up and validate locally

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports