Skip to content

[Improvement] Confusing Exception message: "Could not find a 'develop' or 'main' branch, neither locally nor remotely."  #2598

@odalet

Description

@odalet

When I read this error message, I thought my 'master' branch was not recognized by GitVersion whereas the problem was completely unrelated.

Detailed Description

I was trying to have GitVersion work on a private GitLab instance of ours (I'm still a beginner concerning GitLab) and was presented with this exception. I wrongly assumed there was a problem with GitVersion not finding my 'master' branch... Even tried to declare it in GitVersion.yml but that was for naught. It appears the problem was on the GitLab side due to how we had configured the way it retrieves a git clone (a detached head only listing a unique (non-master) remote branch, no wonder GitVersion didn't work).

I understand, by reading GitVersion code, that 'develop' and 'main' are not real branch names, but rather monikers to whatever the development and the main/principal branch are, but the quotation and the fact they can be real branch names as well is, I suppose, the source of my confusion.

I think that the message either:

  • should list 'master' along 'main' as one of the branches that could not be found:

Could not find a 'develop' or 'main' or 'master' branch, neither locally nor remotely.

  • or avoid the use of the quotes and try to have the reader understand we are talking about branch roles rather than branch names. Something along this line:

Could not find any development or main branch, neither locally nor remotely.

Context

I think this (obvioulsy simple and dispendable) change may help diagnose issues like the one I had.

Possible Implementation

If one or the other of my propositions is accepted, I'll gladly modify the relevant string in a PR

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions