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] Cloning develop throws InvalidOperationException: Sequence contains no matching element #2378

Closed
kcaswick opened this issue Aug 4, 2020 · 7 comments · Fixed by #2379
Labels
Milestone

Comments

@kcaswick
Copy link

kcaswick commented Aug 4, 2020

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
@asbjornu
Copy link
Member

asbjornu commented Aug 4, 2020

Using develop as the main branch without any configuration won't work. GitVersion has intrinsic knowledge and logic built around develop that requires master to exist. If you aren't going to have a master branch, why not just call it main as supported through #2367 (unreleased, but will still be easier and safer to configure)?

@kcaswick
Copy link
Author

kcaswick commented Aug 5, 2020

Master is our main branch. We have a master branch on the server, but when a developer is working locally it only exists as origin/master.

Why should a developer be required to checkout master locally to prevent GitVersion from reporting an error on build? They will never update master directly, that always happens by accepting a pull request in ADO.

In version used, I should have also specified that we are using GitVersionTask.

@asbjornu
Copy link
Member

asbjornu commented Aug 5, 2020

Although it's not a big job normalizing the repository so a local master is available, I agree it shouldn't be necessary. For some reason, it has become required. I'm not sure why or when, but I'll agree that it can be considered a bug.

@bert2
Copy link
Contributor

bert2 commented Sep 9, 2020

I just stumbled upon the same problem, and I agree with OP that a dedicated error message would be very helpful.

@asbjornu
Copy link
Member

asbjornu commented Sep 9, 2020

A pull request that manages to pinpoint where and when this exception occurs and write a custom error message instead would be merged instantaneously.

@asbjornu
Copy link
Member

asbjornu commented Mar 2, 2022

Possibly related to #1671.

@asbjornu asbjornu added this to the 5.x milestone Mar 3, 2022
@arturcic arturcic modified the milestones: 5.x, 5.8.3 Mar 5, 2022
@github-actions
Copy link

github-actions bot commented Mar 5, 2022

🎉 This issue has been resolved in version 5.8.3 🎉
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.

4 participants