8000 Merge pull request #1349 from libgit2/ethomson/libgit2_update · sillyHook/libgit2sharp-ssh@f12a329 · GitHub
[go: up one dir, main page]

Skip to content

Commit f12a329

Browse files
authored
Merge pull request libgit2#1349 from libgit2/ethomson/libgit2_update
Update libgit2 natives to 1.0.160
2 parents 7f9bf0d + 88cf9a7 commit f12a329

15 files changed

+74
-45
lines changed

LibGit2Sharp/Commands/Fetch.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public static void Fetch(Repository repository, string remote, IEnumerable<strin
7171
fetchOptions.Prune = FetchPruneStrategy.FromConfigurationOrDefault;
7272
}
7373

74+
fetchOptions.ProxyOptions = new GitProxyOptions { Version = 1 };
75+
7476
Proxy.git_remote_fetch(remoteHandle, refspecs, fetchOptions, logMessage);
7577
}
7678

LibGit2Sharp/Core/GitDiff.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ internal unsafe struct git_diff_file
249249
public Int64 Size;
250250
public GitDiffFlags Flags;
251251
public UInt16 Mode;
252+
public UInt16 IdAbbrev;
252253
}
253254

254255
[StructLayout(LayoutKind.Sequential)]

LibGit2Sharp/Core/GitErrorCategory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ internal enum GitErrorCategory
3434
Describe,
3535
Rebase,
3636
Filesystem,
37+
Patch
3738
}
3839
}

LibGit2Sharp/Core/GitFetchOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ internal class GitFetchOptions
1010
public FetchPruneStrategy Prune;
1111
public bool UpdateFetchHead = true;
1212
public TagFetchMode download_tags;
13+
public GitProxyOptions ProxyOptions;
1314
public GitStrArrayManaged custom_headers;
1415
}
1516
}

LibGit2Sharp/Core/GitProxyOptions.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace LibGit2Sharp.Core
5+
{
6+
internal enum GitProxyType
7+
{
8+
None,
9+
Auto,
10+
Specified
11+
}
12+
13+
[StructLayout(LayoutKind.Sequential)]
14+
internal struct GitProxyOptions
15+
{
16+
public uint Version;
17+
public GitProxyType Type;
18+
public IntPtr Url;
19+
public IntPtr CredentialsCb;
20+
public IntPtr CertificateCheck;
21+
public IntPtr CbPayload;
22+
}
23+
}

LibGit2Sharp/Core/GitPushOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ internal class GitPushOptions
88
public int Version = 1;
99
public int PackbuilderDegreeOfParallelism;
1010
public GitRemoteCallbacks RemoteCallbacks;
11+
public GitProxyOptions ProxyOptions;
1112
public GitStrArrayManaged CustomHeaders;
1213
}
1314
}

LibGit2Sharp/Core/GitSubmoduleOptions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace LibGit2Sharp.Core
44
{
55
[StructLayout(LayoutKind.Sequential)]
6-
internal struct GitSubmoduleOptions
6+
internal struct GitSubmoduleUpdateOptions
77
{
88
public uint Version;
99

@@ -12,5 +12,7 @@ internal struct GitSubmoduleOptions
1212
public GitFetchOptions FetchOptions;
1313

1414
public CheckoutStrategy CloneCheckoutStrategy;
15+
16+
public int AllowFetch;
1517
}
1618
}

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ internal static extern unsafe int git_blob_create_fromworkdir(
121121
git_repository* repo,
122122
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath relative_path);
123123

124-
internal delegate int source_callback(
125-
IntPtr content,
126-
int max_length,
127-
IntPtr data);
128-
129124
[DllImport(libgit2)]
130125
internal static extern unsafe int git_blob_create_fromstream(
131126
out IntPtr stream,
@@ -137,14 +132,6 @@ internal static extern unsafe int git_blob_create_fromstream_commit(
137132
ref GitOid oid,
138133
IntPtr stream);
139134

140-
[DllImport(libgit2)]
141-
internal static extern unsafe int git_blob_create_fromchunks(
142-
ref GitOid oid,
143-
git_repository* repositoryPtr,
144-
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath hintpath,
145-
source_callback fileCallback,
146-
IntPtr data);
147-
148135
[DllImport(libgit2)]
149136
internal static extern unsafe int git_blob_filtered_content(
150137
GitBuf buf,
@@ -1020,7 +1007,7 @@ internal static extern unsafe int git_packbuilder_insert_tree(
10201007
internal static extern unsafe int git_packbuilder_new(out git_packbuilder* packbuilder, git_repository* repo);
10211008

10221009
[DllImport(libgit2)]
1023-
internal static extern unsafe UInt32 git_packbuilder_object_count(git_packbuilder* packbuilder);
1010+
internal static extern unsafe UIntPtr git_packbuilder_object_count(git_packbuilder* packbuilder);
10241011

10251012
[DllImport(libgit2)]
10261013
internal static extern unsafe UInt32 git_packbuilder_set_threads(git_packbuilder* packbuilder, UInt32 numThreads);
@@ -1034,7 +1021,7 @@ internal static extern unsafe int git_packbuilder_write(
10341021
IntPtr payload);
10351022

10361023
[DllImport(libgit2)]
1037-
internal static extern unsafe UInt32 git_packbuilder_written(git_packbuilder* packbuilder);
1024+
internal static extern unsafe UIntPtr git_packbuilder_written(git_packbuilder* packbuilder);
10381025

10391026
[DllImport(libgit2)]
10401027
internal static extern unsafe int git_reference_create(
@@ -1213,6 +1200,7 @@ internal static extern unsafe int git_remote_connect(
12131200
git_remote* remote,
12141201
GitDirection direction,
12151202
ref GitRemoteCallbacks callbacks,
1203+
ref GitProxyOptions proxy_options,
12161204
ref GitStrArray custom_headers);
12171205

12181206
[DllImport(libgit2)]
@@ -1644,7 +1632,7 @@ internal static extern unsafe int git_submodule_resolve_url(
16441632
internal static extern unsafe int git_submodule_update(
16451633
git_submodule* sm,
16461634
[MarshalAs(UnmanagedType.Bool)] bool init,
1647-
ref GitSubmoduleOptions submoduleUpdateOptions);
1635+
ref GitSubmoduleUpdateOptions submoduleUpdateOptions);
16481636

16491637
internal delegate int submodule_callback(
16501638
IntPtr sm,

LibGit2Sharp/Core/Proxy.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,12 +1693,12 @@ public static unsafe void git_packbuilder_write(PackBuilderHandle packbuilder, F
16931693
Ensure.ZeroResult(res);
16941694
}
16951695

1696-
public static unsafe uint git_packbuilder_object_count(PackBuilderHandle packbuilder)
1696+
public static unsafe UIntPtr git_packbuilder_object_count(PackBuilderHandle packbuilder)
16971697
{
16981698
return NativeMethods.git_packbuilder_object_count(packbuilder);
16991699
}
17001700

1701-
public static unsafe uint git_packbuilder_written(PackBuilderHandle packbuilder)
1701+
public static unsafe UIntPtr git_packbuilder_written(PackBuilderHandle packbuilder)
17021702
{
17031703
return NativeMethods.git_packbuilder_written(packbuilder);
17041704
}
@@ -2149,13 +2149,13 @@ public static unsafe RemoteHandle git_remote_create_anonymous(RepositoryHandle r
21492149
return new RemoteHandle(handle, true);
21502150
}
21512151

2152-
public static unsafe void git_remote_connect(RemoteHandle remote, GitDirection direction, ref GitRemoteCallbacks remoteCallbacks)
2152+
public static unsafe void git_remote_connect(RemoteHandle remote, GitDirection direction, ref GitRemoteCallbacks remoteCallbacks, ref GitProxyOptions proxyOptions)
21532153
{
21542154
GitStrArrayManaged customHeaders = new GitStrArrayManaged();
21552155

21562156
try
21572157
{
2158-
int res = NativeMethods.git_remote_connect(remote, direction, ref remoteCallbacks, ref customHeaders.Array);
2158+
int res = NativeMethods.git_remote_connect(remote, direction, ref remoteCallbacks, ref proxyOptions, ref customHeaders.Array);
21592159
Ensure.ZeroResult(res);
21602160
}
21612161
catch (Exception)
@@ -2993,7 +2993,7 @@ public static unsafe void git_submodule_add_to_index(SubmoduleHandle submodule,
29932993
Ensure.ZeroResult(res);
29942994
}
29952995

2996-
public static unsafe void git_submodule_update(SubmoduleHandle submodule, bool init, ref GitSubmoduleOptions options)
2996+
public static unsafe void git_submodule_update(SubmoduleHandle submodule, bool init, ref GitSubmoduleUpdateOptions options)
29972997
{
29982998
var res = NativeMethods.git_submodule_update(submodule, init, ref options);
29992999
Ensure.ZeroResult(res);
@@ -3348,19 +3348,23 @@ public static BuiltInFeatures git_libgit2_features()
33483348
// C# equivalent of libgit2's git_libgit2_opt_t
33493349
private enum LibGitOption
33503350
{
3351-
GetMWindowSize, // GIT_OPT_GET_MWINDOW_SIZE
3352-
SetMWindowSize, // GIT_OPT_SET_MWINDOW_SIZE
3353-
GetMWindowMappedLimit, // GIT_OPT_GET_MWINDOW_MAPPED_LIMIT
3354-
SetMWindowMappedLimit, // GIT_OPT_SET_MWINDOW_MAPPED_LIMIT
3355-
GetSearchPath, // GIT_OPT_GET_SEARCH_PATH
3356-
SetSearchPath, // GIT_OPT_SET_SEARCH_PATH
3357-
SetCacheObjectLimit, // GIT_OPT_SET_CACHE_OBJECT_LIMIT
3358-
SetCacheMaxSize, // GIT_OPT_SET_CACHE_MAX_SIZE
3359-
EnableCaching, // GIT_OPT_ENABLE_CACHING
3360-
GetCachedMemory, // GIT_OPT_GET_CACHED_MEMORY
3361-
GetTemplatePath, // GIT_OPT_GET_TEMPLATE_PATH
3362-
SetTemplatePath, // GIT_OPT_SET_TEMPLATE_PATH
3363-
SetSslCertLocations, // GIT_OPT_SET_SSL_CERT_LOCATIONS
3351+
GetMWindowSize, // GIT_OPT_GET_MWINDOW_SIZE
3352+
SetMWindowSize, // GIT_OPT_SET_MWINDOW_SIZE
3353+
GetMWindowMappedLimit, // GIT_OPT_GET_MWINDOW_MAPPED_LIMIT
3354+
SetMWindowMappedLimit, // GIT_OPT_SET_MWINDOW_MAPPED_LIMIT
3355+
GetSearchPath, // GIT_OPT_GET_SEARCH_PATH
3356+
SetSearchPath, // GIT_OPT_SET_SEARCH_PATH
3357+
SetCacheObjectLimit, // GIT_OPT_SET_CACHE_OBJECT_LIMIT
3358+
SetCacheMaxSize, // GIT_OPT_SET_CACHE_MAX_SIZE
3359+
EnableCaching, // GIT_OPT_ENABLE_CACHING
3360+
GetCachedMemory, // GIT_OPT_GET_CACHED_MEMORY
3361+
GetTemplatePath, // GIT_OPT_GET_TEMPLATE_PATH
3362+
SetTemplatePath, // GIT_OPT_SET_TEMPLATE_PATH
3363+
SetSslCertLocations, // GIT_OPT_SET_SSL_CERT_LOCATIONS
3364+
SetUserAgent, // GIT_OPT_SET_USER_AGENT
3365+
EnableStrictObjectCreation, // GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
3366+
SetSslCiphers, // GIT_OPT_SET_SSL_CIPHERS
3367+
GetUserAgent, // GIT_OPT_GET_USER_AGENT
33643368
}
33653369

33663370
/// <summary>

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.157\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.157\build\LibGit2Sharp.NativeBinaries.props')" />
3+
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -77,6 +77,7 @@
7777
<Compile Include="CompareOptions.cs" />
7878
<Compile Include="Core\FileHistory.cs" />
7979
<Compile Include="Core\GitFetchOptions.cs" />
80+
<Compile Include="Core\GitProxyOptions.cs" />
8081
<Compile Include="Core\GitPushUpdate.cs" />
8182
<Compile Include="Core\GitSubmoduleIgnore.cs" />
8283
<Compile Include="Core\GitWriteStream.cs" />
@@ -383,7 +384,7 @@
383384
<PropertyGroup>
384385
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
385386
</PropertyGroup>
386-
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.157\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.157\build\LibGit2Sharp.NativeBinaries.props'))" />
387+
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.160\build\LibGit2Sharp.NativeBinaries.props'))" />
387388
</Target>
388389
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
389390
Other similar extension points exist, see Microsoft.Common.targets.

LibGit2Sharp/Network.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,15 @@ private IEnumerable<Reference> ListReferencesInternal(string url, CredentialsHan
118118
using (RemoteHandle remoteHandle = BuildRemoteHandle(repository.Handle, url))
119119
{
120120
GitRemoteCallbacks gitCallbacks = new GitRemoteCallbacks { version = 1 };
121+
GitProxyOptions proxyOptions = new GitProxyOptions { Version = 1 };
121122

122123
if (credentialsProvider != null)
123124
{
124125
var callbacks = new RemoteCallbacks(credentialsProvider);
125126
gitCallbacks = callbacks.GenerateCallbacks();
126127
}
127128

128-
Proxy.git_remote_connect(remoteHandle, GitDirection.Fetch, ref gitCallbacks);
129+
Proxy.git_remote_connect(remoteHandle, GitDirection.Fetch, ref gitCallbacks, ref proxyOptions);
129130
return Proxy.git_remote_ls(repository, remoteHandle);
130131
}
131132
}
@@ -469,6 +470,7 @@ public virtual void Push(Remote remote, IEnumerable<string> pushRefSpecs, PushOp
469470
{
470471
PackbuilderDegreeOfParallelism = pushOptions.PackbuilderDegreeOfParallelism,
471472
RemoteCallbacks = gitCallbacks,
473+
ProxyOptions = new GitProxyOptions { Version = 1 },
472474
});
473475
}
474476
}

LibGit2Sharp/PackBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ internal int SetMaximumNumberOfThreads(int nThread)
107107
/// </summary>
108108
internal long ObjectsCount
109109
{
110-
get { return Proxy.git_packbuilder_object_count(packBuilderHandle); }
110+
get { return (long)Proxy.git_packbuilder_object_count(packBuilderHandle); }
111111
}
112112

113113
/// <summary>
@@ -116,7 +116,7 @@ internal long ObjectsCount
116116
/// </summary>
117117
internal long WrittenObjectsCount
118118
{
119-
get { return Proxy.git_packbuilder_written(packBuilderHandle); }
119+
get { return (long)Proxy.git_packbuilder_written(packBuilderHandle); }
120120
}
121121

122122
internal PackBuilderHandle Handle

LibGit2Sharp/Repository.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,15 @@ public static IEnumerable<Reference> ListRemoteReferences(string url, Credential
636636
using (RemoteHandle remoteHandle = Proxy.git_remote_create_anonymous(repositoryHandle, url))
637637
{
638638
var gitCallbacks = new GitRemoteCallbacks { version = 1 };
639+
var proxyOptions = new GitProxyOptions { Version = 1 };
639640

640641
if (credentialsProvider != null)
641642
{
642643
var callbacks = new RemoteCallbacks(credentialsProvider);
643644
gitCallbacks = callbacks.GenerateCallbacks();
644645
}
645646

646-
Proxy.git_remote_connect(remoteHandle, GitDirection.Fetch, ref gitCallbacks);
647+
Proxy.git_remote_connect(remoteHandle, GitDirection.Fetch, ref gitCallbacks, ref proxyOptions);
647648
return Proxy.git_remote_ls(null, remoteHandle);
648649
}
649650
}
@@ -726,12 +727,14 @@ public static string Clone(string sourceUrl, string workdirPath,
726727
var remoteCallbacks = new RemoteCallbacks(options);
727728
var gitRemoteCallbacks = remoteCallbacks.GenerateCallbacks();
728729

730+
var gitProxyOptions = new GitProxyOptions { Version = 1 };
731+
729732
var cloneOpts = new GitCloneOptions
730733
{
731734
Version = 1,
732735
Bare = options.IsBare ? 1 : 0,
733736
CheckoutOpts = gitCheckoutOptions,
734-
FetchOpts = new GitFetchOptions { RemoteCallbacks = gitRemoteCallbacks },
737+
FetchOpts = new GitFetchOptions { ProxyOptions = gitProxyOptions, RemoteCallbacks = gitRemoteCallbacks },
735738
};
736739

737740
string clonedRepoPath;

LibGit2Sharp/SubmoduleCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ public virtual void Update(string name, SubmoduleUpdateOptions options)
100100
var remoteCallbacks = new RemoteCallbacks(options);
101101
var gitRemoteCallbacks = remoteCallbacks.GenerateCallbacks();
102102

103-
var gitSubmoduleUpdateOpts = new GitSubmoduleOptions
103+
var gitSubmoduleUpdateOpts = new GitSubmoduleUpdateOptions
104104
{
105105
Version = 1,
106106
CheckoutOptions = gitCheckoutOptions,
107-
FetchOptions = new GitFetchOptions { RemoteCallbacks = gitRemoteCallbacks },
107+
FetchOptions = new GitFetchOptions { ProxyOptions = new GitProxyOptions { Version = 1 }, RemoteCallbacks = gitRemoteCallbacks },
108108
CloneCheckoutStrategy = CheckoutStrategy.GIT_CHECKOUT_SAFE
109109
};
110110

LibGit2Sharp/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="LibGit2Sharp.NativeBinaries" version="1.0.157" targetFramework="net4" allowedVersions="[1.0.157]" />
3+
<package id="LibGit2Sharp.NativeBinaries" version="1.0.160" targetFramework="net4" allowedVersions="[1.0.160]" />
44
</packages>

0 commit comments

Comments
 (0)
0