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

Test and Fix for https://github.com/libgit2/libgit2sharp/issues/1851 #1852

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions LibGit2Sharp.Tests/RepositoryFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ public void IsValidWithValidPath()
Assert.True(Repository.IsValid(repoPath));
}

//[Fact]
//public void IsValidWithInvalidGitConfig()
//{
// string repoPath = InitNewRepository();
// File.AppendAllLines(Path.Combine(repoPath, "config"), new[] { @"[diff ""mytool""] command = C:\path\to\mytool\mytool.exe" });
// var ex = Assert.Throws<LibGit2SharpException>(() => Repository.IsValid(repoPath));
// Assert.Equal(@"invalid escape at path\to\mytool\mytool.exe", ex.Message);
//}

[Fact]
public void CanCreateStandardRepo()
{
Expand Down
5 changes: 5 additions & 0 deletions LibGit2Sharp/Core/Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2575,6 +2575,11 @@ public static unsafe void git_repository_open_ext(string path, RepositoryOpenFla
res = NativeMethods.git_repository_open_ext(out repo, path, flags, ceilingDirs);
NativeMethods.git_repository_free(repo);

//if (res == (int)GitErrorCode.Ok)
//{
// NativeMethods.git_repository_free(repo);
//}

if (res == (int)GitErrorCode.NotFound)
{
throw new RepositoryNotFoundException("Path '{0}' doesn't point at a valid Git repository or workdir.",
Expand Down