Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions GitVersionExe.Tests/GitPreparerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using LibGit2Sharp;
using NUnit.Framework;
using Shouldly;
using GitVersion.Helpers;

[TestFixture]
public class GitPreparerTests
Expand Down Expand Up @@ -78,6 +79,34 @@ public void WorksCorrectlyWithRemoteRepository(string branchName, string expecte
}
}

[Test]
public void UsesGitVersionConfigWhenCreatingDynamicRepository()
{
string localRepoPath = PathHelper.GetTempPath();
string repoBasePath = Path.GetDirectoryName(PathHelper.GetTempPath());

try
{
using (var remote = new EmptyRepositoryFixture(new Config()))
{
var configFile = Path.Combine(remote.Repository.Info.WorkingDirectory, "GitVersionConfig.yaml");
File.WriteAllText(configFile, "next-version: 1.0.0");
remote.Repository.Stage(configFile);
remote.Repository.Commit("Add GitVersionConfig");

Repository.Clone(remote.RepositoryPath, localRepoPath);

var arguments = string.Format(" /url {0} /dynamicRepoLocation {1}", remote.RepositoryPath, repoBasePath);
var results = GitVersionHelper.ExecuteIn(localRepoPath, arguments, false);
results.OutputVariables.SemVer.ShouldBe("1.0.0");
}
}
finally
{
DeleteHelper.DeleteGitRepository(repoBasePath);
}
}

[Test]
public void UpdatesExistingDynamicRepository()
{
Expand Down