Skip to content

Commit a6d8457

Browse files
committed
Call InitializeSourceControl
1 parent 7b5d996 commit a6d8457

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/NerdBank.GitVersioning.Tests/VersionOracleTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,8 @@ public void Worktree_Support()
412412
[Fact]
413413
public void GetHeight_EmptyRepo()
414414
{
415+
this.InitializeSourceControl();
416+
415417
Branch head = this.Repo.Head;
416418
Assert.Throws<InvalidOperationException>(() => head.GetHeight());
417419
Assert.Throws<InvalidOperationException>(() => head.GetHeight(c => true));
@@ -420,6 +422,8 @@ public void GetHeight_EmptyRepo()
420422
[Fact]
421423
public void GetVersionHeight_Test()
422424
{
425+
this.InitializeSourceControl();
426+
423427
var first = this.Repo.Commit("First", this.Signer, this.Signer, new CommitOptions { AllowEmptyCommit = true });
424428
var second = this.Repo.Commit("Second", this.Signer, this.Signer, new CommitOptions { AllowEmptyCommit = true });
425429
this.WriteVersionFile();
@@ -430,6 +434,8 @@ public void GetVersionHeight_Test()
430434
[Fact]
431435
public void GetVersionHeight_VersionJsonHasUnrelatedHistory()
432436
{
437+
this.InitializeSourceControl();
438+
433439
// Emulate a repo that used version.json for something else.
434440
string versionJsonPath = Path.Combine(this.RepoPath, "version.json");
435441
File.WriteAllText(versionJsonPath, @"{ ""unrelated"": false }");
@@ -453,6 +459,7 @@ public void GetVersionHeight_VersionJsonHasUnrelatedHistory()
453459
[Fact]
454460
public void GetVersionHeight_VersionJsonHasParsingErrorsInHistory()
455461
{
462+
this.InitializeSourceControl();
456463
this.WriteVersionFile();
457464
Assert.Equal(1, this.GetVersionHeight());
458465

@@ -476,6 +483,8 @@ public void GetVersionHeight_VersionJsonHasParsingErrorsInHistory()
476483
[Fact]
477484
public void GetVersionHeight_IntroducingFiltersIncrementsHeight()
478485
{
486+
this.InitializeSourceControl();
487+
479488
string relativeDirectory = "some-sub-dir";
480489

481490
this.WriteVersionFile(relativeDirectory: relativeDirectory);
@@ -494,6 +503,8 @@ public void GetVersionHeight_IntroducingFiltersIncrementsHeight()
494503
[InlineData(":/some-sub-dir")]
495504
public void GetVersionHeight_IncludeFilter(string includeFilter)
496505
{
506+
this.InitializeSourceControl();
507+
497508
string relativeDirectory = "some-sub-dir";
498509

499510
var versionData = VersionOptions.FromVersion(new Version("1.2"));
@@ -519,6 +530,8 @@ public void GetVersionHeight_IncludeFilter(string includeFilter)
519530
[Fact]
520531
public void GetVersionHeight_IncludeExcludeFilter()
521532
{
533+
this.InitializeSourceControl();
534+
522535
string relativeDirectory = "some-sub-dir";
523536

524537
var versionData = VersionOptions.FromVersion(new Version("1.2"));
@@ -559,6 +572,8 @@ public void GetVersionHeight_IncludeExcludeFilter()
559572
[Fact]
560573
public void GetVersionHeight_IncludeExcludeFilter_NoProjectDirectory()
561574
{
575+
this.InitializeSourceControl();
576+
562577
var versionData = VersionOptions.FromVersion(new Version("1.2"));
563578
versionData.PathFilters = new[]
564579
{
@@ -600,6 +615,8 @@ public void GetVersionHeight_IncludeExcludeFilter_NoProjectDirectory()
600615
[InlineData(":^../excluded-dir")]
601616
public void GetVersionHeight_AddingExcludeDoesNotLowerHeight(string excludePathFilter)
602617
{
618+
this.InitializeSourceControl();
619+
603620
string relativeDirectory = "some-sub-dir";
604621

605622
var versionData = VersionOptions.FromVersion(new Version("1.2"));
@@ -628,6 +645,8 @@ public void GetVersionHeight_AddingExcludeDoesNotLowerHeight(string excludePathF
628645
[Fact]
629646
public void GetVersionHeight_IncludeRoot()
630647
{
648+
this.InitializeSourceControl();
649+
631650
string relativeDirectory = "some-sub-dir";
632651

633652
var versionData = VersionOptions.FromVersion(new Version("1.2"));
@@ -653,6 +672,8 @@ public void GetVersionHeight_IncludeRoot()
653672
[Fact]
654673
public void GetVersionHeight_IncludeRootExcludeSome()
655674
{
675+
this.InitializeSourceControl();
676+
656677
string relativeDirectory = "some-sub-dir";
657678

658679
var versionData = VersionOptions.FromVersion(new Version("1.2"));
@@ -684,6 +705,8 @@ public void GetVersionHeight_IncludeRootExcludeSome()
684705
[Fact]
685706
public void GetVersionHeight_ProjectDirectoryDifferentToVersionJsonDirectory()
686707
{
708+
this.InitializeSourceControl();
709+
687710
string relativeDirectory = "some-sub-dir";
688711

689712
var versionData = VersionOptions.FromVersion(new Version("1.2"));
@@ -706,6 +729,8 @@ public void GetVersionHeight_ProjectDirectoryDifferentToVersionJsonDirectory()
706729
[Fact]
707730
public void GetVersionHeight_ProjectDirectoryIsMoved()
708731
{
732+
this.InitializeSourceControl();
733+
709734
string relativeDirectory = "some-sub-dir";
710735

711736
var versionData = VersionOptions.FromVersion(new Version("1.2"));

0 commit comments

Comments
 (0)