Skip to content

[Bug] Cloning develop throws InvalidOperationException: Sequence contains no matching element #2378

@kcaswick

Description

@kcaswick

Describe the bug
Using develop as our default branch led to GitVersion failing locally with an incomprehensible error.

Expected Behavior

  • Version should be the same as if both master and develop have been checked out locally.
  • Not having master branch should lead to a clear warning message something like "Could not find a 'master' branch, neither locally nor remotely."

Actual Behavior

  System.InvalidOperationException : Sequence contains no matching element
  Stack Trace: 
    Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
    MainlineVersionCalculator.GetMainline(Commit baseVersionSource) line 133
    MainlineVersionCalculator.FindMainlineModeVersion(BaseVersion baseVersion) line 44
    NextVersionCalculator.FindVersion() line 59

Possible Fix

Add origin/master to regex for master.

Steps to Reproduce

See PR #2379 test GivenARemoteGitRepositoryWithCommitsThenClonedLocalDevelopShouldMatchRemoteVersion

Your Environment

  • Version Used: 5.3.7
  • Windows 10
  • Internal Azure DevOps repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions