Skip to content

Commit

Permalink
Update git pathing for CI (#1821)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored May 17, 2024
1 parent a9cc823 commit 0b06f98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/PSRule.Tests/GitHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;

namespace PSRule;
Expand All @@ -15,7 +16,7 @@ public void TryReadHead_WhenValidPath_ShouldReturnGitHead()
{
var expectedHead = GetGitOutput();

Assert.True(GitHelper.TryReadHead(out var actualHead, "../../../../../.git"));
Assert.True(GitHelper.TryReadHead(out var actualHead, GetGitPath()));
Assert.Equal(expectedHead, NormalizeBranch(actualHead));
}

Expand All @@ -40,5 +41,10 @@ private static string GetGitOutput()
return branch;
}

private static string GetGitPath()
{
return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../../../.git");
}

#endregion Helper methods
}

0 comments on commit 0b06f98

Please sign in to comment.