Include default branch configuration in export/import

Summary

Hello, I'm trying to export/import a project with a specific default branch but when I do this the default branch change. (Also have the same problem with group-level custom templates).

I listed the issue as a bug since in the description of the export say all project configurations are exported except integrations. image

Steps to reproduce

  • In a project, create a branch with a name later in the alphabetical order then the default branch.
  • Export the project
  • Import the project

Example Project

Project to export: https://gitlab.com/Calvinaud/project-to-export/-/branches Project imported: https://gitlab.com/Calvinaud/imported-project/-/branches

What is the current bug behavior?

The default branch can change.

What is the expected correct behavior?

The default branch doesn't change.

Relevant logs and/or screenshots

Branch before import: image Branch after import: image

Output of checks

This bug happens on Gitlab.com (in 14.4.0) (also happens in a self-managed instance on 14.3.0)

Possible fixes

Not sure if it's the correct track but it look like in this file: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/import_export/project/import_export.yml that there is no reference of a property "default branch".

Workaround

Change the default_branch in the project settings after the migration is completed

Edited by 🤖 GitLab Bot 🤖