8000 Update libgit2 binaries to eef7e80 · MicrosoftWebMatrix/libgit2sharp@ce5ccef · GitHub
[go: up one dir, main page]

Skip to content

Commit ce5ccef

Browse files
author
Edward Thomson
committed
Update libgit2 binaries to eef7e80
libgit2/libgit2@40a6051...eef7e80
1 parent 4606cf0 commit ce5ccef

18 files changed

+62
-48
lines changed

Lib/NativeBinaries/amd64/git2.dll

-310 KB
Binary file not shown.

Lib/NativeBinaries/amd64/git2.pdb

-1010 KB
Binary file not shown.

Lib/NativeBinaries/x86/git2.dll

-240 KB
Binary file not shown.

Lib/NativeBinaries/x86/git2.pdb

-344 KB
Binary file not shown.

LibGit2Sharp.Tests/CloneFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void CallsProgressCallbacks(string url)
103103

104104
var scd = BuildSelfCleaningDirectory();
105105
using (Repository repo = Repository.Clone(url, scd.RootedDirectoryPath,
106-
onTransferProgress: (_) => transferWasCalled = true,
106+
onTransferProgress: (_) => { transferWasCalled = true; return 0; },
107107
onCheckoutProgress: (a, b, c) => checkoutWasCalled = true))
108108
{
109109
Assert.True(transferWasCalled);

LibGit2Sharp/Branch.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,7 @@ private string RemoteNameFromLocalBranch()
216216

217217
private string RemoteNameFromRemoteTrackingBranch()
218218
{
219-
using (ReferenceSafeHandle branchPtr = repo.Refs.RetrieveReferencePtr(CanonicalName))
220-
{
221-
return Proxy.git_branch_remote_name(repo.Handle, branchPtr);
222-
}
219+
return Proxy.git_branch_remote_name(repo.Handle, CanonicalName);
223220
}
224221

225222
/// <summary>

LibGit2Sharp/BranchCollection.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ public virtual Branch Move(Branch branch, string newName, bool allowOverwrite =
184184

185185
using (ReferenceSafeHandle referencePtr = repo.Refs.RetrieveReferencePtr("refs/heads/" + branch.Name))
186186
{
187-
Proxy.git_branch_move(referencePtr, newName, allowOverwrite);
187+
using (ReferenceSafeHandle ref_out = Proxy.git_branch_move(referencePtr, newName, allowOverwrite))
188+
{
189+
}
188190
}
189191

190192
return this[newName];

LibGit2Sharp/BranchUpdater.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,7 @@ private void GetUpstreamInformation(string canonicalName, out string remoteName,
108108
}
109109
else if (canonicalName.StartsWith(remotePrefix, StringComparison.Ordinal))
110110
{
111-
using (ReferenceSafeHandle branchPtr = repo.Refs.RetrieveReferencePtr(canonicalName))
112-
{
113-
remoteName = Proxy.git_branch_remote_name(repo.Handle, branchPtr);
114-
}
111+
remoteName = Proxy.git_branch_remote_name(repo.Handle, canonicalName);
115112

116113
Remote remote = repo.Network.Remotes.RemoteForName(remoteName);
117114
using (RemoteSafeHandle remoteHandle = Proxy.git_remote_load(repo.Handle, remote.Name, true))

LibGit2Sharp/Core/GitDiff.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,9 @@ public void Dispose()
193193
[Flags]
194194
internal enum GitDiffFileFlags
195195
{
196-
GIT_DIFF_FILE_VALID_OID = (1 << 0),
197-
GIT_DIFF_FILE_FREE_PATH = (1 << 1),
198-
GIT_DIFF_FILE_BINARY = (1 << 2),
199-
GIT_DIFF_FILE_NOT_BINARY = (1 << 3),
200-
GIT_DIFF_FILE_FREE_DATA = (1 << 4),
201-
GIT_DIFF_FILE_UNMAP_DATA = (1 << 5),
196+
GIT_DIFF_FLAG_BINARY = (1 << 0),
197+
GIT_DIFF_FLAG_NOT_BINARY = (1 << 1),
198+
GIT_DIFF_FLAG_VALID_OID = (1 << 2),
202199
}
203200

204201
[StructLayout(LayoutKind.Sequential)]
@@ -218,7 +215,7 @@ internal class GitDiffDelta
218215
public GitDiffFile NewFile;
219216
public ChangeKind Status;
220217
public uint Similarity;
221-
public int Binary;
218+
public uint Flags;
222219
}
223220

224221
[StructLayout(LayoutKind.Sequential)]

LibGit2Sharp/Core/GitDiffExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ internal static class GitDiffExtensions
77
public static bool IsBinary(this GitDiffDelta delta)
88
{
99
//TODO Fix the interop issue on amd64 and use GitDiffDelta.Binary
10-
return delta.OldFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FILE_BINARY)
11-
|| delta.NewFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FILE_BINARY);
10+
return delta.OldFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FLAG_BINARY)
11+
|| delta.NewFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FLAG_BINARY);
1212
}
1313
}
1414
}

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ internal static extern int git_branch_foreach(
137137

138 F987 138
[DllImport(libgit2)]
139139
internal static extern int git_branch_move(
140+
out ReferenceSafeHandle ref_out,
140141
ReferenceSafeHandle reference,
141142
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string new_branch_name,
142143
[MarshalAs(UnmanagedType.Bool)] bool force);
@@ -146,7 +147,7 @@ internal static extern int git_branch_remote_name(
146147
byte[] remote_name_out,
147148
UIntPtr buffer_size,
148149
RepositorySafeHandle repo,
149-
ReferenceSafeHandle branch);
150+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string canonical_branch_name);
150151

151152
[DllImport(libgit2)]
152153
internal static extern int git_branch_tracking_name(
@@ -648,6 +649,7 @@ internal static extern int git_reference_lookup(
648649

649650
[DllImport(libgit2)]
650651
internal static extern int git_reference_rename(
652+
out ReferenceSafeHandle ref_out,
651653
ReferenceSafeHandle reference,
652654
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string newName,
653655
[MarshalAs(UnmanagedType.Bool)] bool force);
@@ -656,10 +658,11 @@ internal static extern int git_reference_rename(
656658
internal static extern int git_reference_resolve(out ReferenceSafeHandle resolvedReference, ReferenceSafeHandle reference);
657659

658660
[DllImport(libgit2)]
659-
internal static extern int git_reference_set_target(ReferenceSafeHandle reference, ref GitOid id);
661+
internal static extern int git_reference_set_target(out ReferenceSafeHandle ref_out, ReferenceSafeHandle reference, ref GitOid id);
660662

661663
[DllImport(libgit2)]
662664
internal static extern int git_reference_symbolic_set_target(
665+
out ReferenceSafeHandle ref_out,
663666
ReferenceSafeHandle reference,
664667
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string target);
665668

@@ -986,7 +989,7 @@ internal static extern int git_tag_delete(
986989
[DllImport(libgit2)]
987990
internal static extern void git_threads_shutdown();
988991

989-
internal delegate void git_transfer_progress_callback(ref GitTransferProgress stats, IntPtr payload);
992+
internal delegate int git_transfer_progress_callback(ref GitTransferProgress stats, IntPtr payload);
990993

991994
[DllImport(libgit2)]
992995
internal static extern uint git_tree_entry_filemode(SafeHandle entry);

LibGit2Sharp/Core/Proxy.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,27 @@ public static ICollection<TResult> git_branch_foreach<TResult>(
135135
return git_foreach(resultSelector, c => NativeMethods.git_branch_foreach(repo, branch_type, (x, y, p) => c(x, y, p), IntPtr.Zero));
136136
}
137137

138-
public static void git_branch_move(ReferenceSafeHandle reference, string new_branch_name, bool force)
138+
public static ReferenceSafeHandle git_branch_move(ReferenceSafeHandle reference, string new_branch_name, bool force)
139139
{
140140
using (ThreadAffinity())
141141
{
142-
int res = NativeMethods.git_branch_move(reference, new_branch_name, force);
142+
ReferenceSafeHandle ref_out;
143+
int res = NativeMethods.git_branch_move(out ref_out, reference, new_branch_name, force);
143144
Ensure.ZeroResult(res);
145+
return ref_out;
144146
}
145147
}
146148

147-
public static string git_branch_remote_name(RepositorySafeHandle repo, ReferenceSafeHandle branch)
149+
public static string git_branch_remote_name(RepositorySafeHandle repo, string canonical_branch_name)
148150
{
149151
using (ThreadAffinity())
150152
{
151-
int bufSize = NativeMethods.git_branch_remote_name(null, UIntPtr.Zero, repo, branch);
153+
int bufSize = NativeMethods.git_branch_remote_name(null, UIntPtr.Zero, repo, canonical_branch_name);
152154
Ensure.Int32Result(bufSize);
153155

154156
var buffer = new byte[bufSize];
155157

156-
int res = NativeMethods.git_branch_remote_name(buffer, (UIntPtr)buffer.Length, repo, branch);
158+
int res = NativeMethods.git_branch_remote_name(buffer, (UIntPtr)buffer.Length, repo, canonical_branch_name);
157159
Ensure.Int32Result(res);
158160

159161
return Utf8Marshaler.Utf8FromBuffer(buffer) ?? string.Empty;
@@ -1124,8 +1126,6 @@ public static void git_reference_delete(ReferenceSafeHandle reference)
11241126
using (ThreadAffinity())
11251127
{
11261128
int res = NativeMethods.git_reference_delete(reference);
1127-
reference.SetHandleAsInvalid();
1128-
11291129
Ensure.ZeroResult(res);
11301130
}
11311131
}
@@ -1192,12 +1192,16 @@ public static ObjectId git_reference_oid(ReferenceSafeHandle reference)
11921192
return NativeMethods.git_reference_target(reference).MarshalAsObjectId();
11931193
}
11941194

1195-
public static void git_reference_rename(ReferenceSafeHandle reference, string newName, bool allowOverwrite)
1195+
public static ReferenceSafeHandle git_reference_rename(ReferenceSafeHandle reference, string newName, bool allowOverwrite)
11961196
{
11971197
using (ThreadAffinity())
11981198
{
1199-
int res = NativeMethods.git_reference_rename(reference, newName, allowOverwrite);
1199+
ReferenceSafeHandle ref_out;
1200+
1201+
int res = NativeMethods.git_reference_rename(out ref_out, reference, newName, allowOverwrite);
12001202
Ensure.ZeroResult(res);
1203+
1204+
return ref_out;
12011205
}
12021206
}
12031207

@@ -1219,22 +1223,30 @@ public static ReferenceSafeHandle git_reference_resolve(ReferenceSafeHandle refe
12191223
}
12201224
}
12211225

1222-
public static void git_reference_set_oid(ReferenceSafeHandle reference, ObjectId id)
1226+
public static ReferenceSafeHandle git_reference_set_target(ReferenceSafeHandle reference, ObjectId id)
12231227
{
12241228
using (ThreadAffinity())
12251229
{
12261230
GitOid oid = id.Oid;
1227-
int res = NativeMethods.git_reference_set_target(reference, ref oid);
1231+
ReferenceSafeHandle ref_out;
1232+
1233+
int res = NativeMethods.git_reference_set_target(out ref_out, reference, ref oid);
12281234
Ensure.ZeroResult(res);
1235+
1236+
return ref_out;
12291237
}
12301238
}
12311239

1232-
public static void git_reference_set_target(ReferenceSafeHandle reference, string target)
1240+
public static ReferenceSafeHandle git_reference_symbolic_set_target(ReferenceSafeHandle reference, string target)
12331241
{
12341242
using (ThreadAffinity())
12351243
{
1236-
int res = NativeMethods.git_reference_symbolic_set_target(reference, target);
1244+
ReferenceSafeHandle ref_out;
1245+
1246+
int res = NativeMethods.git_reference_symbolic_set_target(out ref_out, reference, target);
12371247
Ensure.ZeroResult(res);
1248+
1249+
return ref_out;
12381250
}
12391251
}
12401252

LibGit2Sharp/Diff.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ private GitDiffOptions BuildOptions(DiffOptions diffOptions, IEnumerable<string>
2323
var options = new GitDiffOptions();
2424

2525
options.Flags |= GitDiffOptionFlags.GIT_DIFF_INCLUDE_TYPECHANGE;
26+
options.ContextLines = 3;
2627

2728
if (diffOptions.HasFlag(DiffOptions.IncludeUntracked))
2829
{

LibGit2Sharp/Handlers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
/// Delegate definition for transfer progress callback.
3131
/// </summary>
3232
/// <param name="progress">The <see cref = "TransferProgress" /> object containing progress information.</param>
33-
public delegate void TransferProgressHandler(TransferProgress progress);
33+
/// <returns>Return negative integer to cancel.</returns>
34+
public delegate int TransferProgressHandler(TransferProgress progress);
3435

3536
/// <summary>
3637
/// Delegate definition to handle reporting errors when updating references on the remote.

LibGit2Sharp/ReferenceCollection.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ public virtual Reference Move(Reference reference, string newName, bool allowOve
153153

154154
using (ReferenceSafeHandle handle = RetrieveReferencePtr(reference.CanonicalName))
155155
{
156-
Proxy.git_reference_rename(handle, newName, allowOverwrite);
157-
158-
return Reference.BuildFromPtr<Reference>(handle, repo);
156+
using (ReferenceSafeHandle handle_out = Proxy.git_reference_rename(handle, newName, allowOverwrite))
157+
{
158+
return Reference.BuildFromPtr<Reference>(handle_out, repo);
159+
}
159160
}
160161
}
161162

@@ -181,7 +182,7 @@ public virtual Reference UpdateTarget(Reference directRef, ObjectId targetId)
181182
Ensure.ArgumentNotNull(targetId, "targetId");
182183

183184
return UpdateTarget(directRef, targetId,
184-
(h, id) => Proxy.git_reference_set_oid(h, id));
185+
(h, id) => Proxy.git_reference_set_target(h, id));
185186
}
186187

187188
/// <summary>
@@ -196,10 +197,10 @@ public virtual Reference UpdateTarget(Reference symbolicRef, Reference targetRef
196197
Ensure.ArgumentNotNull(targetRef, "targetRef");
197198

198199
return UpdateTarget(symbolicRef, targetRef,
199-
(h, r) => Proxy.git_reference_set_target(h, r.CanonicalName));
200+
(h, r) => Proxy.git_reference_symbolic_set_target(h, r.CanonicalName));
200201
}
201202

202-
private Reference UpdateTarget<T>(Reference reference, T target, Action<ReferenceSafeHandle, T> setter)
203+
private Reference UpdateTarget<T>(Reference reference, T target, Func<ReferenceSafeHandle, T, ReferenceSafeHandle> setter)
203204
{
204205
if (reference.CanonicalName == "HEAD")
205206
{
@@ -219,8 +220,10 @@ private Reference UpdateTarget<T>(Reference reference, T target, Action<Referenc
219220

220221
using (ReferenceSafeHandle referencePtr = RetrieveReferencePtr(reference.CanonicalName))
221222
{
222-
setter(referencePtr, target);
223-
return Reference.BuildFromPtr<Reference>(referencePtr, repo);
223+
using (ReferenceSafeHandle ref_out = setter(referencePtr, target))
224+
{
225+
return Reference.BuildFromPtr<Reference>(ref_out, repo);
226+
}
224227
}
225228
}
226229

LibGit2Sharp/TransferCallbacks.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ internal static NativeMethods.git_transfer_progress_callback GenerateCallback(Tr
4646
/// </summary>
4747
/// <param name="progress"><see cref = "GitTransferProgress" /> structure containing progress information.</param>
4848
/// <param name="payload">Payload data.</param>
49-
private void OnGitTransferProgress(ref GitTransferProgress progress, IntPtr payload)
49+
/// <returns>the result of the wrapped <see cref = "TransferProgressHandler" /></returns>
50+
private int OnGitTransferProgress(ref GitTransferProgress progress, IntPtr payload)
5051
{
51-
onTransferProgress(new TransferProgress(progress));
52+
return onTransferProgress(new TransferProgress(progress));
5253
}
5354
}
5455
}

LibGit2Sharp/libgit2_hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
40a605104c2060c2bc5a08dfb62cafe473baeb21
1+
eef7e80e68a530f8ce1d1ec196d41fc33a1ced6e

libgit2

Submodule libgit2 updated 206 files

0 commit comments

Comments
 (0)
0