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

Adding setter to GitExePath #2110

Merged
merged 2 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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; }
Copy link
Member

@michaelcfanning michaelcfanning Oct 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set [](start = 40, length = 3)

Add a test that validates this. #Resolved


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();
}
}
}