Skip to content

Commit 276b1a3

Browse files
committed
Test for correct meta-data count when there are remote branches
1 parent f61179c commit 276b1a3

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

GitVersionCore.Tests/Fixtures/RemoteRepositoryFixture.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ public class RemoteRepositoryFixture : RepositoryFixtureBase
88
public string LocalRepositoryPath;
99
public IRepository LocalRepository;
1010

11+
public RemoteRepositoryFixture(Func<string, IRepository> builder, Config configuration)
12+
: base(builder, configuration)
13+
{
14+
CloneRepository();
15+
}
16+
1117
public RemoteRepositoryFixture(Config configuration)
1218
: base(CreateNewRepository, configuration)
1319
{

GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,33 @@ public void GivenARemoteGitRepositoryWithCommits_ThenClonedLocalShouldMatchRemot
1616
}
1717
}
1818

19+
[Test]
20+
public void GivenARemoteGitRepositoryWithCommitsAndBranches_ThenClonedLocalShouldMatchRemoteVersion()
21+
{
22+
using (var fixture = new RemoteRepositoryFixture(
23+
path =>
24+
{
25+
Repository.Init(path);
26+
Console.WriteLine("Created git repository at '{0}'", path);
27+
28+
var repo = new Repository(path);
29+
repo.MakeCommits(5);
30+
31+
repo.CreateBranch("develop");
32+
repo.CreateBranch("release-1.0");
33+
34+
repo.Checkout("release-1.0");
35+
repo.MakeCommits(5);
36+
37+
return repo;
38+
},
39+
new Config()))
40+
{
41+
fixture.AssertFullSemver("1.0.0-beta.1+5");
42+
fixture.AssertFullSemver("1.0.0-beta.1+5", fixture.LocalRepository);
43+
}
44+
}
45+
1946
[Test]
2047
public void GivenARemoteGitRepositoryAheadOfLocalRepository_ThenChangesShouldPull()
2148
{

0 commit comments

Comments
 (0)