diff options
author | Edward Thomson <ethomson@microsoft.com> | 2013-03-06 04:37:37 +0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2013-03-12 01:04:18 +0400 |
commit | ce5ccef5f16762aac93ef90030911c3b483a44d1 (patch) | |
tree | 63a76276343c53a34f418d2a2cc4a2a07aece44a | |
parent | 4606cf01a7cec799f55f7c6ff3187da3c85fedf5 (diff) |
Update libgit2 binaries to eef7e80
https://github.com/libgit2/libgit2/compare/40a6051...eef7e80
-rw-r--r-- | Lib/NativeBinaries/amd64/git2.dll | bin | 1038848 -> 721408 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/amd64/git2.pdb | bin | 6017024 -> 4984832 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/x86/git2.dll | bin | 801792 -> 556032 bytes | |||
-rw-r--r-- | Lib/NativeBinaries/x86/git2.pdb | bin | 5378048 -> 5025792 bytes | |||
-rw-r--r-- | LibGit2Sharp.Tests/CloneFixture.cs | 2 | ||||
-rw-r--r-- | LibGit2Sharp/Branch.cs | 5 | ||||
-rw-r--r-- | LibGit2Sharp/BranchCollection.cs | 4 | ||||
-rw-r--r-- | LibGit2Sharp/BranchUpdater.cs | 5 | ||||
-rw-r--r-- | LibGit2Sharp/Core/GitDiff.cs | 11 | ||||
-rw-r--r-- | LibGit2Sharp/Core/GitDiffExtensions.cs | 4 | ||||
-rw-r--r-- | LibGit2Sharp/Core/NativeMethods.cs | 9 | ||||
-rw-r--r-- | LibGit2Sharp/Core/Proxy.cs | 38 | ||||
-rw-r--r-- | LibGit2Sharp/Diff.cs | 1 | ||||
-rw-r--r-- | LibGit2Sharp/Handlers.cs | 3 | ||||
-rw-r--r-- | LibGit2Sharp/ReferenceCollection.cs | 19 | ||||
-rw-r--r-- | LibGit2Sharp/TransferCallbacks.cs | 5 | ||||
-rw-r--r-- | LibGit2Sharp/libgit2_hash.txt | 2 | ||||
m--------- | libgit2 | 0 |
18 files changed, 61 insertions, 47 deletions
diff --git a/Lib/NativeBinaries/amd64/git2.dll b/Lib/NativeBinaries/amd64/git2.dll Binary files differindex 54267641..71d8fa71 100644 --- a/Lib/NativeBinaries/amd64/git2.dll +++ b/Lib/NativeBinaries/amd64/git2.dll diff --git a/Lib/NativeBinaries/amd64/git2.pdb b/Lib/NativeBinaries/amd64/git2.pdb Binary files differindex 7843c602..3c9e5800 100644 --- a/Lib/NativeBinaries/amd64/git2.pdb +++ b/Lib/NativeBinaries/amd64/git2.pdb diff --git a/Lib/NativeBinaries/x86/git2.dll b/Lib/NativeBinaries/x86/git2.dll Binary files differindex bf2aab77..550e212a 100644 --- a/Lib/NativeBinaries/x86/git2.dll +++ b/Lib/NativeBinaries/x86/git2.dll diff --git a/Lib/NativeBinaries/x86/git2.pdb b/Lib/NativeBinaries/x86/git2.pdb Binary files differindex 38d9e1e0..b621e816 100644 --- a/Lib/NativeBinaries/x86/git2.pdb +++ b/Lib/NativeBinaries/x86/git2.pdb diff --git a/LibGit2Sharp.Tests/CloneFixture.cs b/LibGit2Sharp.Tests/CloneFixture.cs index 0f135060..f5f005d1 100644 --- a/LibGit2Sharp.Tests/CloneFixture.cs +++ b/LibGit2Sharp.Tests/CloneFixture.cs @@ -103,7 +103,7 @@ namespace LibGit2Sharp.Tests var scd = BuildSelfCleaningDirectory(); using (Repository repo = Repository.Clone(url, scd.RootedDirectoryPath, - onTransferProgress: (_) => transferWasCalled = true, + onTransferProgress: (_) => { transferWasCalled = true; return 0; }, onCheckoutProgress: (a, b, c) => checkoutWasCalled = true)) { Assert.True(transferWasCalled); diff --git a/LibGit2Sharp/Branch.cs b/LibGit2Sharp/Branch.cs index ff299261..cb11c1d9 100644 --- a/LibGit2Sharp/Branch.cs +++ b/LibGit2Sharp/Branch.cs @@ -216,10 +216,7 @@ namespace LibGit2Sharp private string RemoteNameFromRemoteTrackingBranch() { - using (ReferenceSafeHandle branchPtr = repo.Refs.RetrieveReferencePtr(CanonicalName)) - { - return Proxy.git_branch_remote_name(repo.Handle, branchPtr); - } + return Proxy.git_branch_remote_name(repo.Handle, CanonicalName); } /// <summary> diff --git a/LibGit2Sharp/BranchCollection.cs b/LibGit2Sharp/BranchCollection.cs index 46226063..82f32918 100644 --- a/LibGit2Sharp/BranchCollection.cs +++ b/LibGit2Sharp/BranchCollection.cs @@ -184,7 +184,9 @@ namespace LibGit2Sharp using (ReferenceSafeHandle referencePtr = repo.Refs.RetrieveReferencePtr("refs/heads/" + branch.Name)) { - Proxy.git_branch_move(referencePtr, newName, allowOverwrite); + using (ReferenceSafeHandle ref_out = Proxy.git_branch_move(referencePtr, newName, allowOverwrite)) + { + } } return this[newName]; diff --git a/LibGit2Sharp/BranchUpdater.cs b/LibGit2Sharp/BranchUpdater.cs index 3eb03458..fd834b90 100644 --- a/LibGit2Sharp/BranchUpdater.cs +++ b/LibGit2Sharp/BranchUpdater.cs @@ -108,10 +108,7 @@ namespace LibGit2Sharp } else if (canonicalName.StartsWith(remotePrefix, StringComparison.Ordinal)) { - using (ReferenceSafeHandle branchPtr = repo.Refs.RetrieveReferencePtr(canonicalName)) - { - remoteName = Proxy.git_branch_remote_name(repo.Handle, branchPtr); - } + remoteName = Proxy.git_branch_remote_name(repo.Handle, canonicalName); Remote remote = repo.Network.Remotes.RemoteForName(remoteName); using (RemoteSafeHandle remoteHandle = Proxy.git_remote_load(repo.Handle, remote.Name, true)) diff --git a/LibGit2Sharp/Core/GitDiff.cs b/LibGit2Sharp/Core/GitDiff.cs index d5c60ecf..b6b7ae8b 100644 --- a/LibGit2Sharp/Core/GitDiff.cs +++ b/LibGit2Sharp/Core/GitDiff.cs @@ -193,12 +193,9 @@ namespace LibGit2Sharp.Core [Flags] internal enum GitDiffFileFlags { - GIT_DIFF_FILE_VALID_OID = (1 << 0), - GIT_DIFF_FILE_FREE_PATH = (1 << 1), - GIT_DIFF_FILE_BINARY = (1 << 2), - GIT_DIFF_FILE_NOT_BINARY = (1 << 3), - GIT_DIFF_FILE_FREE_DATA = (1 << 4), - GIT_DIFF_FILE_UNMAP_DATA = (1 << 5), + GIT_DIFF_FLAG_BINARY = (1 << 0), + GIT_DIFF_FLAG_NOT_BINARY = (1 << 1), + GIT_DIFF_FLAG_VALID_OID = (1 << 2), } [StructLayout(LayoutKind.Sequential)] @@ -218,7 +215,7 @@ namespace LibGit2Sharp.Core public GitDiffFile NewFile; public ChangeKind Status; public uint Similarity; - public int Binary; + public uint Flags; } [StructLayout(LayoutKind.Sequential)] diff --git a/LibGit2Sharp/Core/GitDiffExtensions.cs b/LibGit2Sharp/Core/GitDiffExtensions.cs index cdd00d2a..ae2afaf9 100644 --- a/LibGit2Sharp/Core/GitDiffExtensions.cs +++ b/LibGit2Sharp/Core/GitDiffExtensions.cs @@ -7,8 +7,8 @@ namespace LibGit2Sharp.Core public static bool IsBinary(this GitDiffDelta delta) { //TODO Fix the interop issue on amd64 and use GitDiffDelta.Binary - return delta.OldFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FILE_BINARY) - || delta.NewFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FILE_BINARY); + return delta.OldFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FLAG_BINARY) + || delta.NewFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FLAG_BINARY); } } } diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index 18d30e77..a8650829 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -137,6 +137,7 @@ namespace LibGit2Sharp.Core [DllImport(libgit2)] internal static extern int git_branch_move( + out ReferenceSafeHandle ref_out, ReferenceSafeHandle reference, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string new_branch_name, [MarshalAs(UnmanagedType.Bool)] bool force); @@ -146,7 +147,7 @@ namespace LibGit2Sharp.Core byte[] remote_name_out, UIntPtr buffer_size, RepositorySafeHandle repo, - ReferenceSafeHandle branch); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string canonical_branch_name); [DllImport(libgit2)] internal static extern int git_branch_tracking_name( @@ -648,6 +649,7 @@ namespace LibGit2Sharp.Core [DllImport(libgit2)] internal static extern int git_reference_rename( + out ReferenceSafeHandle ref_out, ReferenceSafeHandle reference, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string newName, [MarshalAs(UnmanagedType.Bool)] bool force); @@ -656,10 +658,11 @@ namespace LibGit2Sharp.Core internal static extern int git_reference_resolve(out ReferenceSafeHandle resolvedReference, ReferenceSafeHandle reference); [DllImport(libgit2)] - internal static extern int git_reference_set_target(ReferenceSafeHandle reference, ref GitOid id); + internal static extern int git_reference_set_target(out ReferenceSafeHandle ref_out, ReferenceSafeHandle reference, ref GitOid id); [DllImport(libgit2)] internal static extern int git_reference_symbolic_set_target( + out ReferenceSafeHandle ref_out, ReferenceSafeHandle reference, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string target); @@ -986,7 +989,7 @@ namespace LibGit2Sharp.Core [DllImport(libgit2)] internal static extern void git_threads_shutdown(); - internal delegate void git_transfer_progress_callback(ref GitTransferProgress stats, IntPtr payload); + internal delegate int git_transfer_progress_callback(ref GitTransferProgress stats, IntPtr payload); [DllImport(libgit2)] internal static extern uint git_tree_entry_filemode(SafeHandle entry); diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index 89e53cb8..6b8a7c41 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -135,25 +135,27 @@ namespace LibGit2Sharp.Core return git_foreach(resultSelector, c => NativeMethods.git_branch_foreach(repo, branch_type, (x, y, p) => c(x, y, p), IntPtr.Zero)); } - public static void git_branch_move(ReferenceSafeHandle reference, string new_branch_name, bool force) + public static ReferenceSafeHandle git_branch_move(ReferenceSafeHandle reference, string new_branch_name, bool force) { using (ThreadAffinity()) { - int res = NativeMethods.git_branch_move(reference, new_branch_name, force); + ReferenceSafeHandle ref_out; + int res = NativeMethods.git_branch_move(out ref_out, reference, new_branch_name, force); Ensure.ZeroResult(res); + return ref_out; } } - public static string git_branch_remote_name(RepositorySafeHandle repo, ReferenceSafeHandle branch) + public static string git_branch_remote_name(RepositorySafeHandle repo, string canonical_branch_name) { using (ThreadAffinity()) { - int bufSize = NativeMethods.git_branch_remote_name(null, UIntPtr.Zero, repo, branch); + int bufSize = NativeMethods.git_branch_remote_name(null, UIntPtr.Zero, repo, canonical_branch_name); Ensure.Int32Result(bufSize); var buffer = new byte[bufSize]; - int res = NativeMethods.git_branch_remote_name(buffer, (UIntPtr)buffer.Length, repo, branch); + int res = NativeMethods.git_branch_remote_name(buffer, (UIntPtr)buffer.Length, repo, canonical_branch_name); Ensure.Int32Result(res); return Utf8Marshaler.Utf8FromBuffer(buffer) ?? string.Empty; @@ -1124,8 +1126,6 @@ namespace LibGit2Sharp.Core using (ThreadAffinity()) { int res = NativeMethods.git_reference_delete(reference); - reference.SetHandleAsInvalid(); - Ensure.ZeroResult(res); } } @@ -1192,12 +1192,16 @@ namespace LibGit2Sharp.Core return NativeMethods.git_reference_target(reference).MarshalAsObjectId(); } - public static void git_reference_rename(ReferenceSafeHandle reference, string newName, bool allowOverwrite) + public static ReferenceSafeHandle git_reference_rename(ReferenceSafeHandle reference, string newName, bool allowOverwrite) { using (ThreadAffinity()) { - int res = NativeMethods.git_reference_rename(reference, newName, allowOverwrite); + ReferenceSafeHandle ref_out; + + int res = NativeMethods.git_reference_rename(out ref_out, reference, newName, allowOverwrite); Ensure.ZeroResult(res); + + return ref_out; } } @@ -1219,22 +1223,30 @@ namespace LibGit2Sharp.Core } } - public static void git_reference_set_oid(ReferenceSafeHandle reference, ObjectId id) + public static ReferenceSafeHandle git_reference_set_target(ReferenceSafeHandle reference, ObjectId id) { using (ThreadAffinity()) { GitOid oid = id.Oid; - int res = NativeMethods.git_reference_set_target(reference, ref oid); + ReferenceSafeHandle ref_out; + + int res = NativeMethods.git_reference_set_target(out ref_out, reference, ref oid); Ensure.ZeroResult(res); + + return ref_out; } } - public static void git_reference_set_target(ReferenceSafeHandle reference, string target) + public static ReferenceSafeHandle git_reference_symbolic_set_target(ReferenceSafeHandle reference, string target) { using (ThreadAffinity()) { - int res = NativeMethods.git_reference_symbolic_set_target(reference, target); + ReferenceSafeHandle ref_out; + + int res = NativeMethods.git_reference_symbolic_set_target(out ref_out, reference, target); Ensure.ZeroResult(res); + + return ref_out; } } diff --git a/LibGit2Sharp/Diff.cs b/LibGit2Sharp/Diff.cs index 279eb6b2..a80e99bd 100644 --- a/LibGit2Sharp/Diff.cs +++ b/LibGit2Sharp/Diff.cs @@ -23,6 +23,7 @@ namespace LibGit2Sharp var options = new GitDiffOptions(); options.Flags |= GitDiffOptionFlags.GIT_DIFF_INCLUDE_TYPECHANGE; + options.ContextLines = 3; if (diffOptions.HasFlag(DiffOptions.IncludeUntracked)) { diff --git a/LibGit2Sharp/Handlers.cs b/LibGit2Sharp/Handlers.cs index 60eb1179..96b64b9f 100644 --- a/LibGit2Sharp/Handlers.cs +++ b/LibGit2Sharp/Handlers.cs @@ -30,7 +30,8 @@ /// Delegate definition for transfer progress callback. /// </summary> /// <param name="progress">The <see cref = "TransferProgress" /> object containing progress information.</param> - public delegate void TransferProgressHandler(TransferProgress progress); + /// <returns>Return negative integer to cancel.</returns> + public delegate int TransferProgressHandler(TransferProgress progress); /// <summary> /// Delegate definition to handle reporting errors when updating references on the remote. diff --git a/LibGit2Sharp/ReferenceCollection.cs b/LibGit2Sharp/ReferenceCollection.cs index 672aec97..8b2f8b05 100644 --- a/LibGit2Sharp/ReferenceCollection.cs +++ b/LibGit2Sharp/ReferenceCollection.cs @@ -153,9 +153,10 @@ namespace LibGit2Sharp using (ReferenceSafeHandle handle = RetrieveReferencePtr(reference.CanonicalName)) { - Proxy.git_reference_rename(handle, newName, allowOverwrite); - - return Reference.BuildFromPtr<Reference>(handle, repo); + using (ReferenceSafeHandle handle_out = Proxy.git_reference_rename(handle, newName, allowOverwrite)) + { + return Reference.BuildFromPtr<Reference>(handle_out, repo); + } } } @@ -181,7 +182,7 @@ namespace LibGit2Sharp Ensure.ArgumentNotNull(targetId, "targetId"); return UpdateTarget(directRef, targetId, - (h, id) => Proxy.git_reference_set_oid(h, id)); + (h, id) => Proxy.git_reference_set_target(h, id)); } /// <summary> @@ -196,10 +197,10 @@ namespace LibGit2Sharp Ensure.ArgumentNotNull(targetRef, "targetRef"); return UpdateTarget(symbolicRef, targetRef, - (h, r) => Proxy.git_reference_set_target(h, r.CanonicalName)); + (h, r) => Proxy.git_reference_symbolic_set_target(h, r.CanonicalName)); } - private Reference UpdateTarget<T>(Reference reference, T target, Action<ReferenceSafeHandle, T> setter) + private Reference UpdateTarget<T>(Reference reference, T target, Func<ReferenceSafeHandle, T, ReferenceSafeHandle> setter) { if (reference.CanonicalName == "HEAD") { @@ -219,8 +220,10 @@ namespace LibGit2Sharp using (ReferenceSafeHandle referencePtr = RetrieveReferencePtr(reference.CanonicalName)) { - setter(referencePtr, target); - return Reference.BuildFromPtr<Reference>(referencePtr, repo); + using (ReferenceSafeHandle ref_out = setter(referencePtr, target)) + { + return Reference.BuildFromPtr<Reference>(ref_out, repo); + } } } diff --git a/LibGit2Sharp/TransferCallbacks.cs b/LibGit2Sharp/TransferCallbacks.cs index d094dd0d..31187062 100644 --- a/LibGit2Sharp/TransferCallbacks.cs +++ b/LibGit2Sharp/TransferCallbacks.cs @@ -46,9 +46,10 @@ namespace LibGit2Sharp /// </summary> /// <param name="progress"><see cref = "GitTransferProgress" /> structure containing progress information.</param> /// <param name="payload">Payload data.</param> - private void OnGitTransferProgress(ref GitTransferProgress progress, IntPtr payload) + /// <returns>the result of the wrapped <see cref = "TransferProgressHandler" /></returns> + private int OnGitTransferProgress(ref GitTransferProgress progress, IntPtr payload) { - onTransferProgress(new TransferProgress(progress)); + return onTransferProgress(new TransferProgress(progress)); } } } diff --git a/LibGit2Sharp/libgit2_hash.txt b/LibGit2Sharp/libgit2_hash.txt index 9e5aa9d2..3df82b31 100644 --- a/LibGit2Sharp/libgit2_hash.txt +++ b/LibGit2Sharp/libgit2_hash.txt @@ -1 +1 @@ -40a605104c2060c2bc5a08dfb62cafe473baeb21 +eef7e80e68a530f8ce1d1ec196d41fc33a1ced6e diff --git a/libgit2 b/libgit2 -Subproject 40a605104c2060c2bc5a08dfb62cafe473baeb2 +Subproject eef7e80e68a530f8ce1d1ec196d41fc33a1ced6 |