Skip to content

Commit

Permalink
Adding setter to GitExePath (#2110)
Browse files Browse the repository at this point in the history
* Adding setter to GitExePath

* adding tests and change to changelog
  • Loading branch information
eddynaka authored Oct 15, 2020
1 parent 029ad61 commit 062facb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ReleaseHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/GitHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
15 changes: 15 additions & 0 deletions src/Test.UnitTests.Sarif/GitHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,20 @@ public void GetRepositoryRoot_WhenCalledOnTheDefaultInstanceWithCachingDisabled_

action.Should().NotThrow();
}

[Fact]
public void GitExePath_WhenPathDoesntExist_SettingManuallyShouldWork()
{
var mockFileSystem = new Mock<IFileSystem>();

mockFileSystem.Setup(x => x.FileExists(It.IsAny<string>())).Returns(false);

var gitHelper = new GitHelper(mockFileSystem.Object);

gitHelper.GitExePath.Should().BeNull();

gitHelper.GitExePath = @"C:\dev";
gitHelper.GitExePath.Should().NotBeNullOrEmpty();
}
}
}

0 comments on commit 062facb

Please sign in to comment.