Skip to content

Commit 56f020e

Browse files
chusemanarturcic
authored andcommitted
Add a worktree repository test
1 parent be2eabd commit 56f020e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using GitTools.Testing;
2+
using LibGit2Sharp;
3+
using NUnit.Framework;
4+
using System.IO;
5+
using GitVersionCore.Tests.Helpers;
6+
7+
namespace GitVersionCore.Tests.IntegrationTests
8+
{
9+
10+
[TestFixture]
11+
public class WorktreeScenarios : TestBase
12+
{
13+
14+
[Test]
15+
[Category("NoMono")]
16+
[Description("LibGit2Sharp fails here when running under Mono")]
17+
public void UseWorktreeRepositoryForVersion()
18+
{
19+
using var fixture = new EmptyRepositoryFixture();
20+
var repoDir = new DirectoryInfo(fixture.RepositoryPath);
21+
var worktreePath = Path.Combine(repoDir.Parent.FullName, $"{repoDir.Name}-v1");
22+
23+
fixture.Repository.MakeATaggedCommit("v1.0.0");
24+
var branchV1 = fixture.Repository.CreateBranch("support/1.0");
25+
26+
fixture.Repository.MakeATaggedCommit("v2.0.0");
27+
fixture.AssertFullSemver("2.0.0");
28+
29+
fixture.Repository.Worktrees.Add(branchV1.CanonicalName, "1.0", worktreePath, false);
30+
using var worktreeFixture = new LocalRepositoryFixture(new Repository(worktreePath));
31+
worktreeFixture.AssertFullSemver("1.0.0");
32+
}
33+
34+
}
35+
}

0 commit comments

Comments
 (0)