[go: up one dir, main page]

Skip to content

Projects created from a custom template use the wrong default branch when multiple are provided

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When using custom group-level project templates with multiple branches based off the default branch, it is possible to enter a situation where the new project uses a different default branch to the template. This was brought about from a customer report in this ticket.

Steps to reproduce

  1. Under a top-level group, create a subgroup which will house project templates. In this subgroup, create a project with a basic README.md file.
  2. In the project, create multiple new branches based off the existing default branch, main. For example, branches: another-branch, release/stg.
  3. Using the 'Create from template' option within the top-level group, use the Group-defined template you created.
  4. Confirm that the 'default branch' in this new project is not main, and is one of the other two branches you created.

Example Project

Access can be provided to the following repositories by request:

What is the current bug behavior?

The 'default' branch is not retained during import from template.

What is the expected correct behavior?

The 'default' branch is retained during import, with the other branches remaining available, but not the default.

Relevant logs and/or screenshots

Protected Branches

The template project only consists of main being protected, but the created project has a new protected branch entry, with this branch set as the default.

Template Project Created Project
image image

There appears to also be some UI-related behaviour in the new project once created. This is an example where both main and release/stg are shown as the default:

image

Output of checks

This bug happens on GitLab.com

Possible fixes

Is it possible this occurs when the other branches all refer to the same SHA?

Edited by 🤖 GitLab Bot 🤖