Skip to content

Commit 070d9c3

Browse files
committed
WIP
1 parent fdf4d97 commit 070d9c3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Diff for: LibGit2Sharp/Configuration.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ internal Configuration(
5252
private void Init(Repository repository)
5353
{
5454
configHandle = Proxy.git_config_new();
55-
RepositoryHandle repoHandle = (repository != null) ? repository.Handle : null;
55+
RepositoryHandle repoHandle = repository?.Handle ?? new RepositoryHandle();
5656

57-
if (repoHandle != null)
57+
if (!repoHandle.IsInvalid)
5858
{
5959
//TODO: push back this logic into libgit2.
6060
// As stated by @carlosmn "having a helper function to load the defaults and then allowing you

Diff for: LibGit2Sharp/Core/Proxy.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,7 @@ public static unsafe SignatureInfo git_commit_extract_signature(RepositoryHandle
438438

439439
public static unsafe void git_config_add_file_ondisk(ConfigurationHandle config, FilePath path, ConfigurationLevel level, RepositoryHandle repo)
440440
{
441-
// RepositoryHandle does implicit cast voodoo that is not null-safe, thus this explicit check
442-
RepositoryHandle repoHandle = (repo != null) ? (RepositoryHandle)repo : null;
443-
int res = NativeMethods.git_config_add_file_ondisk(config, path, (uint)level, repoHandle, true);
441+
int res = NativeMethods.git_config_add_file_ondisk(config, path, (uint)level, repo, true);
444442
Ensure.ZeroResult(res);
445443
}
446444

0 commit comments

Comments
 (0)