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

[Bug] Unable to suppress "Multiple branch configurations match the current branch" #3735

Closed
gerardog opened this issue Oct 24, 2023 · 3 comments
Labels

Comments

@gerardog
Copy link

Describe the bug

  1. The warning "Multiple branch configurations match the current branch" should not appear with /verbosity quiet
  2. The warning should be written to StdErr so capturing gitversion shouldnt break.

Actual Behavior

Parsing the json output of gitversion fails if there is a branch that matches more than one branch regex

PS C:\git\aa> $version = dotnet-gitversion | Convertfrom-Json
ConvertFrom-Json: Conversion from JSON failed with error: Unexpected character encountered while parsing value: M. Path '', line 0, position 0.
PS C:\git\aa> $version = dotnet-gitversion | Convertfrom-Json
PS C:\git\aa> $version = dotnet-gitversion /nocache| Convertfrom-Json
ConvertFrom-Json: Conversion from JSON failed with error: Unexpected character encountered while parsing value: M. Path '', line 0, position 0.

Possible Fix

Steps to Reproduce

Run in powershell for multiline support

md test
cd test
git init

echo "mode: Mainline
branches:
   master:
     regex: '^master$|^main$'
   other:
     mode: ContinuousDelivery
     regex: '^(?!master$|^main$/).*$'  # All branches except main, master
     tag: '{BranchName}'               # Shall have a prerelease tag based on the branch name.
     source-branches: ['main', 'master']
     increment: patch" > .\GitVersion.yml

git add . 
git commit -m "Added gitversion"
dotnet-gitversion 

{
  "Major": 0,
  "Minor": 1,
  "Patch": 1,
  ...
}

git checkout -B feature/hello

dotnet-gitversion 

Multiple branch configurations match the current branch branchName of 'feature/a'. Using the first matching configuration, 'other'. Matching configurations include:'
 - other
 - feature'
{
 "Major": 0,
  "Minor": 1,
  "Patch": 1,
 
}

Context

Your Environment

  • dotnet tool install GitVersion.Tool --global
  • 5.12.0+Branch.support-5.x.Sha.3f75764963eb3d7956dcd5a40488c074dd9faf9e
  • Version Used:
  • Operating System and version (Windows 10, Ubuntu 18.04):
  • Link to your project:
  • Link to your CI build (if appropriate):
@HHobeck
Copy link
Contributor

HHobeck commented Oct 25, 2023

Does this happen also with the 6.0.0-beta-3 version of git version?

@gerardog
Copy link
Author

gerardog commented Oct 25, 2023

If you run the steps in 6.0.0-beta-3 you will first find this issue:

Could not build the configuration instance because following exception occurred: 'Property 'tag' not found on type 'GitVersion.Configuration.BranchConfiguration'.' Please ensure that the /overrideconfig parameters are correct and the configuration file is in the correct format.

I'm worried I couldnt find the breaking change reason, fix or workaround by digging around the docs or doing a quick look at the releases. This change will break a lot of customers. Maybe it's time to setup a 6.x migration guide.

Regarding the warning: It no longer ocurrs in 6.x since the warning was removed:
diff

Uploading image.png…

@HHobeck
Copy link
Contributor

HHobeck commented Oct 25, 2023

Okay great then it is not a problem anymore. :)

After the features are finalized and the bugs are fixed the documentation needs to be done of course. Currently GitVersion is in the beta stage with following open issues: https://github.com/GitTools/GitVersion/milestone/19

It seems to be that you are a sophisticated programmer. Are you interested to help with one of this issues?

@HHobeck HHobeck closed this as completed Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants