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] GetReleaseBranchConfig returns only a single config #3050

Closed
Turnerj opened this issue Mar 16, 2022 · 1 comment · Fixed by #3051
Closed

[Bug] GetReleaseBranchConfig returns only a single config #3050

Turnerj opened this issue Mar 16, 2022 · 1 comment · Fixed by #3051
Labels
Milestone

Comments

@Turnerj
Copy link
Contributor

Turnerj commented Mar 16, 2022

Describe the bug

In 666bd37, to support nullable reference types, a change was made to GetReleaseBranchConfig however it did more than support nullable reference types - it actually changed the behaviour of the method. Previously the method would return all release branch configs however now it only returns the first. This is a problem if you have more than one release branch config set.

Expected Behavior

The method to return a list of all release branch configurations.

Actual Behavior

The method returns a list with only the first found release branch configuration.

Possible Fix

Mostly revert back to the previous code though without the ? checks so the values are compatible with nullable reference type checks.

    public static List<KeyValuePair<string, BranchConfig>> GetReleaseBranchConfig(this Config configuration) =>
        configuration.Branches
            .Where(b => b.Value.IsReleaseBranch == true)
            .ToList();

Steps to Reproduce

public void GetReleaseBranchConfigReturnsAllReleaseBranches()
{
    var config = new Config()
    {
        Branches = new Dictionary<string, BranchConfig>
        {
            { "foo", new BranchConfig { Name = "foo" } },
            { "bar", new BranchConfig { Name = "bar", IsReleaseBranch = true } },
            { "baz", new BranchConfig { Name = "baz", IsReleaseBranch = true } }
        }
    };

    var result = config.GetReleaseBranchConfig();

    result.Count.ShouldBe(2);
    result.ShouldNotContain(b => b.Key == "foo");
}
  1. Have more than one release branch configured
  2. Call the method and have it not return all the release branch configs

Context

We have multiple release branches and the change in behaviour inadvertently made our version numbers wrong.

Your Environment

  • Version Used: 5.9.0
@Turnerj Turnerj added the bug label Mar 16, 2022
@arturcic arturcic added this to the 5.x milestone Mar 16, 2022
@arturcic arturcic modified the milestones: 5.x, 5.10.0 Apr 14, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 5.10.0 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants