|
5 | 5 | using GitVersion.VersionCalculation;
|
6 | 6 | using LibGit2Sharp;
|
7 | 7 | using NUnit.Framework;
|
| 8 | +using Shouldly; |
8 | 9 |
|
9 | 10 | namespace GitVersion.Core.Tests.IntegrationTests;
|
10 | 11 |
|
@@ -537,6 +538,32 @@ public void BranchWithoutMergeBaseMainlineBranchIsFound()
|
537 | 538 | fixture.AssertFullSemver("0.1.3-issue-branch.1", currentConfig);
|
538 | 539 | }
|
539 | 540 |
|
| 541 | + [Test] |
| 542 | + public void GivenARemoteGitRepositoryWithCommitsThenClonedLocalDevelopShouldMatchRemoteVersion() |
| 543 | + { |
| 544 | + using var fixture = new RemoteRepositoryFixture(); |
| 545 | + fixture.AssertFullSemver("0.1.4", config); |
| 546 | + fixture.BranchTo("develop"); |
| 547 | + fixture.AssertFullSemver("0.2.0-alpha.0", config); |
| 548 | + Console.WriteLine(fixture.SequenceDiagram.GetDiagram()); |
| 549 | + var local = fixture.CloneRepository(); |
| 550 | + fixture.AssertFullSemver("0.2.0-alpha.0", config, repository: local.Repository); |
| 551 | + local.Repository.DumpGraph(); |
| 552 | + } |
| 553 | + |
| 554 | + [Test] |
| 555 | + public void GivenNoMainThrowsWarning() |
| 556 | + { |
| 557 | + using var fixture = new EmptyRepositoryFixture(); |
| 558 | + fixture.Repository.MakeACommit(); |
| 559 | + fixture.Repository.MakeATaggedCommit("1.0.0"); |
| 560 | + fixture.Repository.MakeACommit(); |
| 561 | + Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop")); |
| 562 | + fixture.Repository.Branches.Remove(fixture.Repository.Branches["main"]); |
| 563 | + |
| 564 | + var exception = Assert.Throws<WarningException>(() => fixture.AssertFullSemver("1.1.0-alpha.1", config)); |
| 565 | + exception.Message.ShouldMatch("No branches can be found matching the commit .* in the configured Mainline branches: main, support"); |
| 566 | + } |
540 | 567 | }
|
541 | 568 |
|
542 | 569 | internal static class CommitExtensions
|
|
0 commit comments