Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add path filtering support to version.json #399

Merged
merged 26 commits into from Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/NerdBank.GitVersioning.Tests/BuildIntegrationTests.cs
Expand Up @@ -183,7 +183,7 @@ public async Task GetBuildVersion_In_Git_But_Head_Lacks_VersionFile()
this.WriteVersionFile("3.4");
Assumes.True(repo.Index[VersionFile.JsonFileName] == null);
var buildResult = await this.BuildAsync();
Assert.Equal("3.4.0." + repo.Head.Commits.First().GetIdAsVersion().Revision, buildResult.BuildVersion);
Assert.Equal("3.4.0." + repo.Head.Commits.First().GetIdAsVersion(TODO).Revision, buildResult.BuildVersion);
Assert.Equal("3.4.0+" + repo.Head.Commits.First().Id.Sha.Substring(0, VersionOptions.DefaultGitCommitIdShortFixedLength), buildResult.AssemblyInformationalVersion);
}

Expand All @@ -208,7 +208,7 @@ public async Task GetBuildVersion_In_Git_No_VersionFile_At_All()
var repo = new Repository(this.RepoPath); // do not assign Repo property to avoid commits being generated later
repo.Commit("empty", this.Signer, this.Signer, new CommitOptions { AllowEmptyCommit = true });
var buildResult = await this.BuildAsync();
Assert.Equal("0.0.0." + repo.Head.Commits.First().GetIdAsVersion().Revision, buildResult.BuildVersion);
Assert.Equal("0.0.0." + repo.Head.Commits.First().GetIdAsVersion(TODO).Revision, buildResult.BuildVersion);
Assert.Equal("0.0.0+" + repo.Head.Commits.First().Id.Sha.Substring(0, VersionOptions.DefaultGitCommitIdShortFixedLength), buildResult.AssemblyInformationalVersion);
}

Expand Down Expand Up @@ -288,7 +288,7 @@ public async Task GetBuildVersion_StableRelease()
var buildResult = await this.BuildAsync();
this.AssertStandardProperties(VersionOptions.FromVersion(new Version(majorMinorVersion)), buildResult);

Version version = this.Repo.Head.Commits.First().GetIdAsVersion();
Version version = this.Repo.Head.Commits.First().GetIdAsVersion(TODO);
Assert.Equal($"{version.Major}.{version.Minor}.{buildResult.GitVersionHeight}", buildResult.NuGetPackageVersion);
}

Expand Down Expand Up @@ -976,10 +976,10 @@ private static RestoreEnvironmentVariables ApplyEnvironmentVariables(IReadOnlyDi

private void AssertStandardProperties(VersionOptions versionOptions, BuildResults buildResult, string relativeProjectDirectory = null)
{
int versionHeight = this.Repo.GetVersionHeight(relativeProjectDirectory);
Version idAsVersion = this.Repo.GetIdAsVersion(relativeProjectDirectory);
int versionHeight = this.Repo.GetVersionHeight(TODO, relativeProjectDirectory);
Version idAsVersion = this.Repo.GetIdAsVersion(TODO, relativeProjectDirectory);
string commitIdShort = this.CommitIdShort;
Version version = this.Repo.GetIdAsVersion(relativeProjectDirectory);
Version version = this.Repo.GetIdAsVersion(TODO, relativeProjectDirectory);
Version assemblyVersion = GetExpectedAssemblyVersion(versionOptions, version);
var additionalBuildMetadata = from item in buildResult.BuildResult.ProjectStateAfterBuild.GetItems("BuildMetadata")
select item.EvaluatedInclude;
Expand Down
96 changes: 48 additions & 48 deletions src/NerdBank.GitVersioning.Tests/GitExtensionsTests.cs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/NerdBank.GitVersioning.Tests/VersionFileTests.cs
Expand Up @@ -440,13 +440,13 @@ public void VersionJson_Inheritance(bool commitInSourceControl, bool bareRepo)

// The version height should be the same for all those that inherit the version from the base,
// even though the inheriting files were introduced in successive commits.
Assert.Equal(totalCommits, operatingRepo.GetVersionHeight());
Assert.Equal(totalCommits, operatingRepo.GetVersionHeight("foo"));
Assert.Equal(totalCommits, operatingRepo.GetVersionHeight(@"foo\bar"));
Assert.Equal(totalCommits, operatingRepo.GetVersionHeight(TODO));
Assert.Equal(totalCommits, operatingRepo.GetVersionHeight(TODO, "foo"));
Assert.Equal(totalCommits, operatingRepo.GetVersionHeight(TODO, @"foo\bar"));

// These either don't inherit, or inherit but reset versions, so the commits were reset.
Assert.Equal(2, operatingRepo.GetVersionHeight("noInherit"));
Assert.Equal(1, operatingRepo.GetVersionHeight("inheritWithVersion"));
Assert.Equal(2, operatingRepo.GetVersionHeight(TODO, "noInherit"));
Assert.Equal(1, operatingRepo.GetVersionHeight(TODO, "inheritWithVersion"));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/NerdBank.GitVersioning.Tests/VersionOracleTests.cs
Expand Up @@ -101,18 +101,18 @@ public void VersionHeightResetsWithVersionSpecChanges(string initial, string nex

var oracle = VersionOracle.Create(this.RepoPath);
Assert.Equal(11, oracle.VersionHeight);
Assert.Equal(11, this.Repo.Head.GetVersionHeight());
Assert.Equal(11, this.Repo.Head.GetVersionHeight(TODO));

options.Version = SemanticVersion.Parse(next);

this.WriteVersionFile(options);
oracle = VersionOracle.Create(this.RepoPath);
Assert.Equal(1, oracle.VersionHeight);
Assert.Equal(1, this.Repo.Head.GetVersionHeight());
Assert.Equal(1, this.Repo.Head.GetVersionHeight(TODO));

foreach (var commit in this.Repo.Head.Commits)
{
var versionFromId = commit.GetIdAsVersion();
var versionFromId = commit.GetIdAsVersion(TODO);
Assert.Contains(commit, this.Repo.GetCommitsFromVersion(versionFromId));
}
}
Expand Down