Skip to content

Commit

Permalink
Merge pull request #515 from dotnet/fixOtherFolder
Browse files Browse the repository at this point in the history
Fix msbuild task handling of `ProjectPathRelativeToGitRepoRoot`
  • Loading branch information
AArnott authored Sep 29, 2020
2 parents 031e528 + 39e6747 commit 4607417
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/NerdBank.GitVersioning/VersionOracle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,17 @@ public VersionOracle(string projectDirectory, LibGit2Sharp.Repository repo, IClo
public VersionOracle(string projectDirectory, LibGit2Sharp.Repository repo, LibGit2Sharp.Commit head, ICloudBuild cloudBuild, int? overrideVersionHeightOffset = null, string projectPathRelativeToGitRepoRoot = null)
{
var relativeRepoProjectDirectory = projectPathRelativeToGitRepoRoot ?? repo?.GetRepoRelativePath(projectDirectory);
if (repo is object)
{
// If we're particularly git focused, normalize/reset projectDirectory to be the path we *actually* want to look at in case we're being redirected.
projectDirectory = Path.Combine(repo.Info.WorkingDirectory, relativeRepoProjectDirectory);
}

var commit = head ?? repo?.Head.Tip;

var committedVersion = VersionFile.GetVersion(commit, relativeRepoProjectDirectory);

var workingVersion = head != null ? VersionFile.GetVersion(head, relativeRepoProjectDirectory) : VersionFile.GetVersion(projectDirectory);
var workingVersion = head is object ? VersionFile.GetVersion(head, relativeRepoProjectDirectory) : VersionFile.GetVersion(projectDirectory);

if (overrideVersionHeightOffset.HasValue)
{
Expand Down

0 comments on commit 4607417

Please sign in to comment.