diff --git a/src/ReleaseHistory.md b/src/ReleaseHistory.md index ccf85efc8..eb01b6dcd 100644 --- a/src/ReleaseHistory.md +++ b/src/ReleaseHistory.md @@ -4,7 +4,7 @@ * FEATURE: Add a converter for FlawFinder's CSV output format. * DEPENDENCY BREAKING: SARIF now requires Newtonsoft.JSON 11.0.2 (rather than 10.0.3) * DEPENDENCY: SARIF TypeScript package now requires minimist 1.2.3 or later (rather than >=1.2.0) ->>>>>>> master +* FEATURE: Add a setter to `GitHelper.GitExePath`. [#2110](https://github.com/microsoft/sarif-sdk/pull/2110) ## **v2.3.6** [Sdk](https://www.nuget.org/packages/Sarif.Sdk/2.3.6) | [Driver](https://www.nuget.org/packages/Sarif.Driver/2.3.6) | [Converters](https://www.nuget.org/packages/Sarif.Converters/2.3.6) | [Multitool](https://www.nuget.org/packages/Sarif.Multitool/2.3.6) | [Multitool Library](https://www.nuget.org/packages/Sarif.Multitool.Library/2.3.6) * BUGFIX: Restore multitool client app package build. diff --git a/src/Sarif/GitHelper.cs b/src/Sarif/GitHelper.cs index 647935d28..87b582cc6 100644 --- a/src/Sarif/GitHelper.cs +++ b/src/Sarif/GitHelper.cs @@ -46,7 +46,7 @@ public GitHelper(IFileSystem fileSystem = null, ProcessRunner processRunner = nu GitExePath = GetGitExePath(); } - public string GitExePath { get; } + public string GitExePath { get; set; } public Uri GetRemoteUri(string repoPath) { diff --git a/src/Test.UnitTests.Sarif/GitHelperTests.cs b/src/Test.UnitTests.Sarif/GitHelperTests.cs index fe02d3a63..be9c544cf 100644 --- a/src/Test.UnitTests.Sarif/GitHelperTests.cs +++ b/src/Test.UnitTests.Sarif/GitHelperTests.cs @@ -117,5 +117,20 @@ public void GetRepositoryRoot_WhenCalledOnTheDefaultInstanceWithCachingDisabled_ action.Should().NotThrow(); } + + [Fact] + public void GitExePath_WhenPathDoesntExist_SettingManuallyShouldWork() + { + var mockFileSystem = new Mock(); + + mockFileSystem.Setup(x => x.FileExists(It.IsAny())).Returns(false); + + var gitHelper = new GitHelper(mockFileSystem.Object); + + gitHelper.GitExePath.Should().BeNull(); + + gitHelper.GitExePath = @"C:\dev"; + gitHelper.GitExePath.Should().NotBeNullOrEmpty(); + } } }