Skip to content

Commit a633a10

Browse files
author
Johannes Egger
committed
Create test to verify that tracking branches are correctly set up when using a dynamic repository
1 parent 97dade8 commit a633a10

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

GitVersionExe.Tests/GitPreparerTests.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,41 @@ public void UsesGitVersionConfigWhenCreatingDynamicRepository()
208208
}
209209
}
210210

211+
[Test]
212+
public void UsingDynamicRepositoryWithFeatureBranchWorks()
213+
{
214+
var repoName = Guid.NewGuid().ToString();
215+
var tempPath = Path.GetTempPath();
216+
var tempDir = Path.Combine(tempPath, repoName);
217+
Directory.CreateDirectory(tempDir);
218+
219+
try
220+
{
221+
using (var mainRepositoryFixture = new EmptyRepositoryFixture(new Config()))
222+
{
223+
var commitId = mainRepositoryFixture.Repository.MakeACommit().Id.Sha;
224+
225+
var arguments = new Arguments
226+
{
227+
TargetPath = tempDir,
228+
TargetUrl = mainRepositoryFixture.RepositoryPath,
229+
TargetBranch = "feature1",
230+
CommitId = commitId
231+
};
232+
233+
var gitPreparer = new GitPreparer(arguments.TargetUrl, arguments.DynamicRepositoryLocation, arguments.Authentication, arguments.TargetBranch, arguments.NoFetch, arguments.TargetPath);
234+
gitPreparer.Initialise(true);
235+
236+
mainRepositoryFixture.Repository.CreateBranch("feature1").Checkout();
237+
238+
Assert.DoesNotThrow(() => gitPreparer.Initialise(true));
239+
}
240+
}
241+
finally
242+
{
243+
Directory.Delete(tempDir, true);
244+
}
245+
}
246+
211247
// TODO test around normalisation
212248
}

0 commit comments

Comments
 (0)