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] If -diag switch is specified first, -config is ignored #2853

Open
beatcracker opened this issue Sep 21, 2021 · 2 comments
Open

[Bug] If -diag switch is specified first, -config is ignored #2853

beatcracker opened this issue Sep 21, 2021 · 2 comments
Labels
Milestone

Comments

@beatcracker
Copy link

beatcracker commented Sep 21, 2021

Describe the bug

If -diag switch is specified first in commandline arguments, the -config switch is ignored.

Expected Behavior

Order of arguments should not matter.

Actual Behavior

Position of -diag switch affects argument parsing: -config switch is ignored.

Steps to Reproduce

mkdir repro
cd repro
dotnet tool install --global GitVersion.Tool
echo wtf > GitVersion.yml
echo next-version: 3.2.1 > custom.yml
git init
git commit -m "FooBar" --allow-empty
dotnet-gitversion -config custom.yml -diag
dotnet-gitversion -diag -config custom.yml

First GitVersion invocation (dotnet-gitversion -config custom.yml -diag) will run succefuly and return:

{
  "Major": 3,
  "Minor": 2,
  "Patch": 1,
  // ...
}

The second invocation will fail, since -diag switch is specified first and it'll ignore config file specified via -config and will try to read GitVersiion.yml.

YamlDotNet.Core.YamlException: (Line: 1, Col: 1, Idx: 0) - (Line: 1, Col: 4, Idx: 3): Exception during deserialization

Context

It's very hard to try various configurations when order of switches affects result.
Related: #2848

Your Environment

  • Operating System and version: Windows 10
  • GitVesion: 5.7.0+Branch.main.Sha.8d177c6d666c8eeb1c6a6a2c71fd4b78741137d2
@asbjornu
Copy link
Member

Seems like we don't have a test for -diag at all. I suppose the bug may be that -config is parsed as a value for -diag somehow. It should be fairly easy to test and fix. Are you up for submitting a PR?

@HHobeck HHobeck added this to the 6.x milestone Apr 2, 2023
@arturcic arturcic added stale and removed stale labels Jun 30, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Sep 29, 2023
@arturcic arturcic removed the stale label Sep 29, 2023
@arturcic arturcic added stale and removed stale labels Oct 30, 2023
@HHobeck HHobeck modified the milestones: 6.x, 7.x Jan 11, 2024
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

4 participants