Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default branch not set when you create a new GIT repository and don't initialize it during creation #2187

Open
MarcelBruckner opened this issue Jul 31, 2023 · 3 comments
Labels
bug Something isn't working stale Issue is stale and will be closed if no further activity occurs

Comments

@MarcelBruckner
Copy link

Issue description

The default branch is not set when you create a new GIT repository and don't initialize it during creation.
When you open Settings > Git Settings in the repository the default branch is nonetheless set.
If I clone the repository via JGit programmatically, it responds that the HEAD is not set and the clone fails.
If I manually create a new branch, set this one as a the new default and then set the original one, it works as expected.
Cloning the repo via Git Bash works as expected in either case.

To me it seems that the UI shows a default branch, even tho none is set.
JGit seems to not be "intelligent" enough to resolve to the repository HEAD.

Bug Report

Describe how to reproduce the bug

Create a new GIT repository and don't tick the initialize repository checkbox.

Describe your SCM-Manager setup

  • SCM-Manager 2.41.1
  • JGit

Which operating system, browser and versions do you use?

  • Red Hat Enterprise Linux Server 7.9
@eheimbuch
Copy link
Member

Thanks for the report. You are right and we will fix this. Currently the default branch can be shown in the ui but not be set.

We will check on the first push to a new repository whether a git config already exist. If the git config is not set yet, we will check the pushed branches and try to find the best candidate to be the default branch by heuristics.

@eheimbuch eheimbuch added the bug Something isn't working label Aug 14, 2023
@stale
Copy link

stale bot commented Sep 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue is stale and will be closed if no further activity occurs label Sep 17, 2023
@christophloose
Copy link

Hi @Brucknem this should be fixed with version 2.46. of SCM-Manager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Issue is stale and will be closed if no further activity occurs
Projects
None yet
Development

No branches or pull requests

3 participants