diff --git a/GitVersionExe.Tests/GitPreparerTests.cs b/GitVersionExe.Tests/GitPreparerTests.cs index bc77b5217b..9ef804cf77 100644 --- a/GitVersionExe.Tests/GitPreparerTests.cs +++ b/GitVersionExe.Tests/GitPreparerTests.cs @@ -5,6 +5,7 @@ using LibGit2Sharp; using NUnit.Framework; using Shouldly; +using GitVersion.Helpers; [TestFixture] public class GitPreparerTests @@ -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() {