From dcd16d8bc4f503206920fbf0e13c291914890edd Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 16 Oct 2019 10:27:29 +0100 Subject: [PATCH 1/4] Update libgit2 to ef5a385 --- LibGit2Sharp/LibGit2Sharp.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index cf51b4efc..de205fc56 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -27,7 +27,7 @@ - + From 8b2ed492bdd1e22c2d6c92f83113bf0f4871ea08 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 16 Oct 2019 11:50:41 +0100 Subject: [PATCH 2/4] GitRemoteCallbacks: add url_resolve callback --- LibGit2Sharp/Core/GitRemoteCallbacks.cs | 2 ++ LibGit2Sharp/Core/NativeMethods.cs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/LibGit2Sharp/Core/GitRemoteCallbacks.cs b/LibGit2Sharp/Core/GitRemoteCallbacks.cs index 4c797b596..54cdb46ed 100644 --- a/LibGit2Sharp/Core/GitRemoteCallbacks.cs +++ b/LibGit2Sharp/Core/GitRemoteCallbacks.cs @@ -34,5 +34,7 @@ internal struct GitRemoteCallbacks internal IntPtr transport; internal IntPtr payload; + + internal NativeMethods.url_resolve_callback resolve_url; } } diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index 7079ecdc4..7bbc08f8d 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -2037,6 +2037,13 @@ internal static extern unsafe int git_cherrypick_commit(out git_index* index, [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] internal static extern void git_transaction_free(IntPtr txn); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate int url_resolve_callback( + IntPtr url_resolved, + IntPtr url, + int direction, + IntPtr payload); + [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe void git_worktree_free(git_worktree* worktree); From aad6094987777d996bc162b6d591ed64b1c92f23 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 16 Oct 2019 12:00:34 +0100 Subject: [PATCH 3/4] Rebase: include new commit signing callback --- LibGit2Sharp/Core/GitRebaseOptions.cs | 2 ++ LibGit2Sharp/Core/NativeMethods.cs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/LibGit2Sharp/Core/GitRebaseOptions.cs b/LibGit2Sharp/Core/GitRebaseOptions.cs index 3ae4e0ed1..e1416e803 100644 --- a/LibGit2Sharp/Core/GitRebaseOptions.cs +++ b/LibGit2Sharp/Core/GitRebaseOptions.cs @@ -17,5 +17,7 @@ internal class GitRebaseOptions public GitMergeOpts merge_options = new GitMergeOpts { Version = 1 }; public GitCheckoutOpts checkout_options = new GitCheckoutOpts { version = 1 }; + + public NativeMethods.commit_signing_callback signing_callback; } } diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index 7bbc08f8d..60bd0a915 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -321,6 +321,13 @@ internal static extern unsafe int git_branch_remote_name( git_repository* repo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string canonical_branch_name); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate int commit_signing_callback( + IntPtr signature, + IntPtr signature_field, + IntPtr commit_content, + IntPtr payload); + [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] internal static extern unsafe int git_rebase_init( out git_rebase* rebase, From 64ab9718f772f776bae7a90efa6f6450eead849c Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 16 Oct 2019 12:12:37 +0100 Subject: [PATCH 4/4] Clone: remove obsolete test for pathless URLs URLs without a path are perfectly valid; the path is implicitly `/`. libgit2 was incorrectly rejecting these paths, and LibGit2Sharp was incorrectly testing this bad behavior. Remove this test now that libgit2 has fixed this issue. --- LibGit2Sharp.Tests/CloneFixture.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/LibGit2Sharp.Tests/CloneFixture.cs b/LibGit2Sharp.Tests/CloneFixture.cs index 976ef9322..09af475fd 100644 --- a/LibGit2Sharp.Tests/CloneFixture.cs +++ b/LibGit2Sharp.Tests/CloneFixture.cs @@ -297,14 +297,6 @@ public void CanInspectCertificateOnClone(string url, string hostname, Type certT Assert.True(checksHappy); } - [Fact] - public void CloningAnUrlWithoutPathThrows() - { - var scd = BuildSelfCleaningDirectory(); - - Assert.Throws(() => Repository.Clone("http://github.com", scd.DirectoryPath)); - } - [Theory] [InlineData("git://github.com/libgit2/TestGitRepository")] public void CloningWithoutWorkdirPathThrows(string url)