8000 Update libgit2 to e0383fa · ravindp/libgit2sharp@369bb76 · GitHub
[go: up one dir, main page]

Skip to content

Commit 369bb76

Browse files
Edward Thomsonnulltoken
Edward Thomson
authored andcommitted
Update libgit2 to e0383fa
1 parent cf7c5e5 commit 369bb76

17 files changed

+81
-38
lines changed
-920 KB
Binary file not shown.
-5.29 MB
Binary file not shown.
944 KB
Binary file not shown.
5.33 MB
Binary file not shown.
-702 KB
Binary file not shown.
718 KB
Binary file not shown.

LibGit2Sharp.Tests/FilterBranchFixture.cs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ public void CanRewriteParents()
609609
// Graft the orphan "test" branch to the tip of "packed"
610610
//
611611
// Before:
612-
// * e90810b (test, lw, e90810b, test)
612+
// * e90810b (test, tag: lw, tag: e90810b, tag: test)
613613
// |
614614
// * 6dcf9bf
615615
// <------------------ note: no connection
@@ -619,7 +619,7 @@ public void CanRewriteParents()
619619
//
620620
// ... and after:
621621
//
622-
// * f558880 (test, lw, e90810b, test)
622+
// * f558880 (test, tag: lw, tag: e90810b, tag: test)
623623
// |
624624
// * 0c25efa
625625
// | <------------------ add this link
@@ -630,29 +630,40 @@ public void CanRewriteParents()
630630
public void CanRewriteParentWithRewrittenCommit()
631631
{
632632
var commitToRewrite = repo.Lookup<Commit>("6dcf9bf");
633-
var newParent = repo.Lookup<Commit>("41bc8c6");
633+
var newParent = repo.Branches["packed"].Tip;
634+
635+
Assert.True(newParent.Sha.StartsWith("41bc8c6"));
634636

635637
repo.Refs.RewriteHistory(new RewriteHistoryOptions
636638
{
637639
OnError = OnError,
638640
OnSucceeding = OnSucceeding,
639-
CommitHeaderRewriter =
640-
c =>
641-
c.Id != newParent.Id
642-
? null
643-
: CommitRewriteInfo.From(c, message: "changed"),
644641
CommitParentsRewriter =
645642
c =>
646643
c.Id != commitToRewrite.Id
647644
? c.Parents
648645
: new[] { newParent }
649-
}, commitToRewrite, newParent);
646+
}, commitToRewrite);
650647

651648
AssertSucceedingButNotError();
652649

653-
var rewrittenParent = repo.Lookup<Commit>("refs/heads/test~").Parents.Single();
654-
Assert.Equal(newParent.Tree, rewrittenParent.Tree);
655-
Assert.NotEqual(newParent, rewrittenParent);
650+
// Assert "packed" hasn't been rewritten
651+
Assert.True(repo.Branches["packed"].Tip.Sha.StartsWith("41bc8c6"));
652+
653+
// Assert (test, tag: lw, tag: e90810b, tag: test) have been rewritten
654+
var rewrittenTestCommit = repo.Branches["test"].Tip;
655+
Assert.True(rewrittenTestCommit.Sha.StartsWith("f558880"));
656+
Assert.Equal(rewrittenTestCommit, repo.Lookup<Commit>("refs/tags/lw^{commit}"));
657+
Assert.Equal(rewrittenTestCommit, repo.Lookup<Commit>("refs/tags/e90810b^{commit}"));
658+
Assert.Equal(rewrittenTestCommit, repo.Lookup<Commit>("refs/tags/test^{commit}"));
659+
660+
// Assert parent of rewritten commit
661+
var rewrittenTestCommitParent = rewrittenTestCommit.Parents.Single();
662+
Assert.True(rewrittenTestCommitParent.Sha.StartsWith("0c25efa"));
663+
664+
// Assert grand parent of rewritten commit
665+
var rewrittenTestCommitGrandParent = rewrittenTestCommitParent.Parents.Single();
666+
Assert.True(rewrittenTestCommitGrandParent.Sha.StartsWith("41bc8c6"));
656667
}
657668

658669
[Fact]

LibGit2Sharp/Core/GitRemoteCallbacks.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ internal struct GitRemoteCallbacks
1717

1818
internal NativeMethods.git_cred_acquire_cb acquire_credentials;
1919

20+
internal IntPtr certificate_check;
21+
2022
internal NativeMethods.git_transfer_progress_callback download_progress;
2123

2224
internal NativeMethods.remote_update_tips_callback update_tips;

LibGit2Sharp/Core/NativeDllName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace LibGit2Sharp.Core
22
{
33
internal static class NativeDllName
44
{
5-
public const string Name = "git2-69db893";
5+
public const string Name = "git2-e0383fa";
66
}
77
}

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,14 +1043,17 @@ internal static extern int git_remote_create_with_fetchspec(
10431043
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string refspec);
10441044

10451045
[DllImport(libgit2)]
1046-
internal static extern int git_remote_delete(RemoteSafeHandle remote);
1046+
internal static extern int git_remote_delete(
1047+
RepositorySafeHandle repo,
1048+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
10471049

10481050
[DllImport(libgit2)]
10491051
internal static extern void git_remote_disconnect(RemoteSafeHandle remote);
10501052

10511053
[DllImport(libgit2)]
10521054
internal static extern int git_remote_fetch(
10531055
RemoteSafeHandle remote,
1056+
ref GitStrArray refspecs,
10541057
SignatureSafeHandle signature,
10551058
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
10561059

@@ -1251,6 +1254,7 @@ internal static extern int git_reset(
12511254
RepositorySafeHandle repo,
12521255
GitObjectSafeHandle target,
12531256
ResetMode reset_type,
1257+
ref GitCheckoutOpts opts,
12541258
SignatureSafeHandle signature,
12551259
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
12561260

LibGit2Sharp/Core/Proxy.cs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,16 +1888,14 @@ public static void git_remote_delete(RepositorySafeHandle repo, string name)
18881888
{
18891889
using (ThreadAffinity())
18901890
{
1891-
using (RemoteSafeHandle remote = git_remote_load(repo, name, false))
1892-
{
1893-
if (remote == null)
1894-
{
1895-
return;
1896-
}
1891+
int res = NativeMethods.git_remote_delete(repo, name);
18971892

1898-
int res = NativeMethods.git_remote_delete(remote);
1899-
Ensure.ZeroResult(res);
1893+
if (res == (int)GitErrorCode.NotFound)
1894+
{
1895+
return;
19001896
}
1897+
1898+
Ensure.ZeroResult(res);
19011899
}
19021900
}
19031901

@@ -2013,8 +2011,17 @@ public static void git_remote_fetch(RemoteSafeHandle remote, Signature signature
20132011
using (ThreadAffinity())
20142012
using (var sigHandle = signature.BuildHandle())
20152013
{
2016-
int res = NativeMethods.git_remote_fetch(remote, sigHandle, logMessage);
2017-
Ensure.ZeroResult(res);
2014+
var array = new GitStrArrayNative();
2015+
2016+
try
2017+
{
2018+
int res = NativeMethods.git_remote_fetch(remote, ref array.Array, sigHandle, logMessage);
2019+
Ensure.ZeroResult(res);
2020+
}
2021+
finally
2022+
{
2023+
array.Dispose();
2024+
}
20182025
}
20192026
}
20202027

@@ -2418,14 +2425,15 @@ public static void git_reset(
24182425
RepositorySafeHandle repo,
24192426
ObjectId committishId,
24202427
ResetMode resetKind,
2428+
ref GitCheckoutOpts checkoutOptions,
24212429
Signature signature,
24222430
string logMessage)
24232431
{
24242432
using (ThreadAffinity())
24252433
using (var osw = new ObjectSafeWrapper(committishId, repo))
24262434
using (var sigHandle = signature.BuildHandle())
24272435
{
2428-
int res = NativeMethods.git_reset(repo, osw.ObjectPtr, resetKind, sigHandle, logMessage);
2436+
int res = NativeMethods.git_reset(repo, osw.ObjectPtr, resetKind, ref checkoutOptions, sigHandle, logMessage);
24292437
Ensure.ZeroResult(res);
24302438
}
24312439
}

LibGit2Sharp/HistoryDivergence.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected HistoryDivergence()
2020
internal HistoryDivergence(Repository repo, Commit one, Commit another)
2121
{
2222
commonAncestor = new Lazy<Commit>(() => repo.Commits.FindMergeBase(one, another));
23-
Tuple<int?, int?> div = Proxy.git_graph_ahead_behind(repo.Handle, another, one);
23+
Tuple<int?, int?> div = Proxy.git_graph_ahead_behind(repo.Handle, one, another);
2424

2525
One = one;
2626
Another = another;

LibGit2Sharp/Repository.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,20 @@ private void CheckoutTree(
736736
/// <param name="signature">Identity for use when updating the reflog.</param>
737737
/// <param name="logMessage">Message to use when updating the reflog.</param>
738738
public void Reset(ResetMode resetMode, Commit commit, Signature signature, string logMessage)
739+
{
740+
Reset(resetMode, commit, new CheckoutOptions(), signature, logMessage);
741+
}
742+
743+
/// <summary>
744+
/// Sets the current <see cref="Head"/> to the specified commit and optionally resets the <see cref="Index"/> and
745+
/// the content of the working tree to match.
746+
/// </summary>
747+
/// <param name="resetMode">Flavor of reset operation to perform.</param>
748+
/// <param name="commit">The target commit object.</param>
749+
/// <param name="opts">Collection of parameters controlling checkout behavior.</param>
750+
/// <param name="signature">Identity for use when updating the reflog.</param>
751+
/// <param name="logMessage">Message to use when updating the reflog.</param>
752+
private void Reset(ResetMode resetMode, Commit commit, IConvertableToGitCheckoutOpts opts, Signature signature, string logMessage)
739753
{
740754
Ensure.ArgumentNotNull(commit, "commit");
741755

@@ -746,7 +760,11 @@ public void Reset(ResetMode resetMode, Commit commit, Signature signature, strin
746760
"reset: moving to {0}", commit.Sha);
747761
}
748762

749-
Proxy.git_reset(handle, commit.Id, resetMode, signature.OrDefault(Config), logMessage);
763+
using (GitCheckoutOptsWrapper checkoutOptionsWrapper = new GitCheckoutOptsWrapper(opts))
764+
{
765+
var options = checkoutOptionsWrapper.Options;
766+
Proxy.git_reset(handle, commit.Id, resetMode, ref options, signature.OrDefault(Config), logMessage);
767+
}
750768
}
751769

752770
/// <summary>

LibGit2Sharp/libgit2_hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
69db89342712f47ee84d9368823ec294a0db1c65
1+
e0383fa35f981c656043976a43c61bff059cb709

libgit2

Submodule libgit2 updated 220 files

nuget.package/build/LibGit2Sharp.props

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
4-
<None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\amd64\git2-69db893.dll">
5-
<Link>NativeBinaries\amd64\git2-69db893.dll</Link>
4+
<None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\amd64\git2-e0383fa.dll">
5+
<Link>NativeBinaries\amd64\git2-e0383fa.dll</Link>
66
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
77
</None>
8-
<None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\amd64\git2-69db893.pdb">
9-
<Link>NativeBinaries\amd64\git2-69db893.pdb</Link>
8+
<None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\amd64\git2-e0383fa.pdb">
9+
<Link>NativeBinaries\amd64\git2-e0383fa.pdb</Link>
1010
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1111
</None>
12-
<None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\x86\git2-69db893.dll">
13-
<Link>NativeBinaries\x86\git2-69db893.dll</Link>
12+
<None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\x86\git2-e0383fa.dll">
13+
<Link>NativeBinaries\x86\git2-e0383fa.dll</Link>
1414
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1515
</None>
16-
<None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\x86\git2-69db893.pdb">
17-
<Link>NativeBinaries\x86\git2-69db893.pdb</Link>
16+
<None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\x86\git2-e0383fa.pdb">
17+
<Link>NativeBinaries\x86\git2-e0383fa.pdb</Link>
1818
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1919
</None>
2020
</ItemGroup>

0 commit comments

Comments
 (0)
0