Skip to content

Commit 14ab41c

Browse files
committed
Bind git_remote_fetch()
1 parent 8124810 commit 14ab41c

File tree

3 files changed

+8
-30
lines changed

3 files changed

+8
-30
lines changed

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -987,8 +987,10 @@ internal static extern int git_remote_create_with_fetchspec(
987987
internal static extern void git_remote_disconnect(RemoteSafeHandle remote);
988988

989989
[DllImport(libgit2)]
990-
internal static extern int git_remote_download(
991-
RemoteSafeHandle remote);
990+
internal static extern int git_remote_fetch(
991+
RemoteSafeHandle remote,
992+
SignatureSafeHandle signature,
993+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
992994

993995
[DllImport(libgit2)]
994996
internal static extern void git_remote_free(IntPtr remote);
@@ -1049,12 +1051,6 @@ internal delegate int remote_update_tips_callback(
10491051
ref GitOid newId,
10501052
IntPtr data);
10511053

1052-
[DllImport(libgit2)]
1053-
internal static extern int git_remote_update_tips(
1054-
RemoteSafeHandle remote,
1055-
SignatureSafeHandle signature,
1056-
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
1057-
10581054
[DllImport(libgit2)]
10591055
internal static extern int git_repository_discover(
10601056
GitBuf buf,

LibGit2Sharp/Core/Proxy.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,11 +1781,12 @@ public static void git_remote_set_push_refspecs(RemoteSafeHandle remote, IEnumer
17811781
}
17821782
}
17831783

1784-
public static void git_remote_download(RemoteSafeHandle remote)
1784+
public static void git_remote_fetch(RemoteSafeHandle remote, Signature signature, string logMessage)
17851785
{
17861786
using (ThreadAffinity())
1787+
using (var sigHandle = signature.BuildHandle())
17871788
{
1788-
int res = NativeMethods.git_remote_download(remote);
1789+
int res = NativeMethods.git_remote_fetch(remote, sigHandle, logMessage);
17891790
Ensure.ZeroResult(res);
17901791
}
17911792
}
@@ -1890,16 +1891,6 @@ public static void git_remote_set_callbacks(RemoteSafeHandle remote, ref GitRemo
18901891
}
18911892
}
18921893

1893-
public static void git_remote_update_tips(RemoteSafeHandle remote, Signature signature, string logMessage)
1894-
{
1895-
using (ThreadAffinity())
1896-
using (var sigHandle = signature.BuildHandle())
1897-
{
1898-
int res = NativeMethods.git_remote_update_tips(remote, sigHandle, logMessage);
1899-
Ensure.ZeroResult(res);
1900-
}
1901-
}
1902-
19031894
public static string git_remote_url(RemoteSafeHandle remote)
19041895
{
19051896
return NativeMethods.git_remote_url(remote);

LibGit2Sharp/Network.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,7 @@ static void DoFetch(RemoteSafeHandle remoteHandle, FetchOptions options, Signatu
121121
// GC occuring in between setting the remote callbacks and actual usage in one of the functions afterwords.
122122
Proxy.git_remote_set_callbacks(remoteHandle, ref gitCallbacks);
123123

124-
try
125-
{
126-
Proxy.git_remote_connect(remoteHandle, GitDirection.Fetch);
127-
Proxy.git_remote_download(remoteHandle);
128-
Proxy.git_remote_update_tips(remoteHandle, signature, logMessage);
129-
}
130-
finally
131-
{
132-
Proxy.git_remote_disconnect(remoteHandle);
133-
}
124+
Proxy.git_remote_fetch(remoteHandle, signature, logMessage);
134125
}
135126

136127
/// <summary>

0 commit comments

Comments
 (0)