8000 Update libgit2 to 3f8d005 · ravindp/libgit2sharp@ed519c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed519c5

Browse files
author
Edward Thomson
committed
Update libgit2 to 3f8d005
libgit2/libgit2@e0383fa...3f8d005
1 parent 7a31788 commit ed519c5

20 files changed

+94
-130
lines changed
963 KB
Binary file not shown.
-944 KB
Binary file not shown.
730 KB
Binary file not shown.
-718 KB
Binary file not shown.

LibGit2Sharp.Tests/RemoteFixture.cs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ public void CanRenameExistingRemote()
259259
}
260260

261261
[Fact]
262-
public void CanRenameNonExistingRemote()
262+
public void RenamingNonExistingRemoteThrows()
263263
{
264264
using (var repo = new Repository(StandardTestRepoPath))
265265
{
266-
Assert.Null(repo.Network.Remotes["i_dont_exist"]);
267-
268-
repo.Network.Remotes.Rename("i_dont_exist", "i_dont_either", problem => Assert.True(false));
269-
Assert.Null(repo.Network.Remotes["i_dont_either"]);
266+
Assert.Throws<NotFoundException>(() =>
267+
{
268+
repo.Network.Remotes.Rename("i_dont_exist", "i_dont_either");
269+
});
270270
}
271271
}
272272

@@ -327,20 +327,5 @@ public void CanNotRenameWhenRemoteWithSameNameExists()
327327
Assert.Throws<NameConflictException>(() => repo.Network.Remotes.Rename("origin", "upstream"));
328328
}
329329
}
330-
331-
[Theory]
332-
[InlineData("git@github.com:org/repo.git", false)]
333-
[InlineData("git://site.com:80/org/repo.git", true)]
334-
[InlineData("ssh://user@host.com:80/org/repo.git", false)]
335-
[InlineData("http://site.com:80/org/repo.git", true)]
336-
[InlineData("https://github.com:80/org/repo.git", true)]
337-
[InlineData("ftp://site.com:80/org/repo.git", false)]
338-
[InlineData("ftps://site.com:80/org/repo.git", false)]
339-
[InlineData("file:///path/repo.git", true)]
340-
[InlineData("protocol://blah.meh/whatever.git", false)]
341-
public void CanCheckIfUrlisSupported(string url, bool supported)
342-
{
343-
Assert.Equal(supported, Remote.IsSupportedUrl(url));
344-
}
345330
}
346331
}

LibGit2Sharp/Core/GitDiff.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ internal class GitDiffOptions : IDisposable
205205

206206
/* options controlling how to diff text is generated */
207207

208-
public ushort ContextLines;
209-
public ushort InterhunkLines;
208+
public uint ContextLines;
209+
public uint InterhunkLines;
210210
public ushort IdAbbrev;
211211
public Int64 MaxSize;
212212
public IntPtr OldPrefixString;

LibGit2Sharp/Core/Handles/GitMergeHeadHandle.cs renamed to LibGit2Sharp/Core/Handles/GitAnnotatedCommitHandle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace LibGit2Sharp.Core.Handles
44
{
5-
internal class GitMergeHeadHandle : SafeHandleBase
5+
internal class GitAnnotatedCommitHandle : SafeHandleBase
66
{
77
protected override bool ReleaseHandleImpl()
88
{
9-
Proxy.git_merge_head_free(handle);
9+
Proxy.git_annotated_commit_free(handle);
1010
return true;
1111
}
1212
}

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-e0383fa";
5+
public const string Name = "git2-3f8d005";
66
}
77
}

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,15 @@ internal static extern int git_branch_remote_name(
215215
[DllImport(libgit2)]
216216
internal static extern int git_remote_rename(
217217
ref GitStrArray problems,
218-
RemoteSafeHandle remote,
218+
RepositorySafeHandle repo,
219+
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string old_name,
219220
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_name);
220221

221222
internal delegate int git_remote_rename_problem_cb(
222223
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] string problematic_refspec,
223224
IntPtr payload);
224225

225226

226-
[DllImport(libgit2)]
227-
[return: MarshalAs(UnmanagedType.Bool)]
228-
internal static extern bool git_remote_supported_url(
229-
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
230-
231227
[DllImport(libgit2)]
232228
internal static extern int git_branch_upstream_name(
233229
GitBuf buf,
@@ -630,28 +626,28 @@ internal static extern int git_merge_base_octopus(
630626
[In] GitOid[] input_array);
631627

632628
[DllImport(libgit2)]
633-
internal static extern int git_merge_head_from_ref(
634-
out GitMergeHeadHandle mergehead,
629+
internal static extern int git_annotated_commit_from_ref(
630+
out GitAnnotatedCommitHandle annotatedCommit,
635631
RepositorySafeHandle repo,
636632
ReferenceSafeHandle reference);
637633

638634
[DllImport(libgit2)]
639-
internal static extern int git_merge_head_from_fetchhead(
640-
out GitMergeHeadHandle mergehead,
635+
internal static extern int git_annotated_commit_from_fetchhead(
636+
out GitAnnotatedCommitHandle annotatedCommit,
641637
RepositorySafeHandle repo,
642638
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string branch_name,
643639
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote_url,
644640
ref GitOid oid);
645641

646642
[DllImport(libgit2)]
647-
internal static extern int git_merge_head_from_id(
648-
out GitMergeHeadHandle mergehead,
643+
internal static extern int git_annotated_commit_lookup(
644+
out GitAnnotatedCommitHandle annotatedCommit,
649645
RepositorySafeHandle repo,
650646
ref GitOid id);
651647

652648
[DllImport(libgit2)]
653-
internal static extern OidSafeHandle git_merge_head_id(
654-
GitMergeHeadHandle mergeHead);
649+
internal static extern OidSafeHandle git_annotated_commit_id(
650+
GitAnnotatedCommitHandle annotatedCommit);
655651

656652
[DllImport(libgit2)]
657653
internal static extern int git_merge(
@@ -670,7 +666,7 @@ internal static extern int git_merge_analysis(
670666
int their_heads_len);
671667

672668
[DllImport(libgit2)]
673-
internal static extern void git_merge_head_free(
669+
internal static extern void git_annotated_commit_free(
674670
IntPtr merge_head);
675671

676672
[DllImport(libgit2)]

LibGit2Sharp/Core/Proxy.cs

Lines changed: 37 additions & 43 deletions
10000
Original file line numberDiff line numberDiff line change
@@ -1048,54 +1048,54 @@ public static ObjectId git_merge_base_octopus(RepositorySafeHandle repo, GitOid[
10481048
}
10491049
}
10501050

1051-
public static GitMergeHeadHandle git_merge_head_from_fetchhead(RepositorySafeHandle repo, string branchName, string remoteUrl, GitOid oid)
1051+
public static GitAnnotatedCommitHandle git_annotated_commit_from_fetchhead(RepositorySafeHandle repo, string branchName, string remoteUrl, GitOid oid)
10521052
{
10531053
using (ThreadAffinity())
10541054
{
1055-
GitMergeHeadHandle merge_head;
1055+
GitAnnotatedCommitHandle merge_head;
10561056

1057-
int res = NativeMethods.git_merge_head_from_fetchhead(out merge_head, repo, branchName, remoteUrl, ref oid);
1057+
int res = NativeMethods.git_annotated_commit_from_fetchhead(out merge_head, repo, branchName, remoteUrl, ref oid);
10581058

10591059
Ensure.ZeroResult(res);
10601060

10611061
return merge_head;
10621062
}
10631063
}
10641064

1065-
public static GitMergeHeadHandle git_merge_head_from_id(RepositorySafeHandle repo, GitOid oid)
1065+
public static GitAnnotatedCommitHandle git_annotated_commit_lookup(RepositorySafeHandle repo, GitOid oid)
10661066
{
10671067
using (ThreadAffinity())
10681068
{
1069-
GitMergeHeadHandle their_head;
1069+
GitAnnotatedCommitHandle their_head;
10701070

1071-
int res = NativeMethods.git_merge_head_from_id(out their_head, repo, ref oid);
1071+
int res = NativeMethods.git_annotated_commit_lookup(out their_head, repo, ref oid);
10721072

10731073
Ensure.ZeroResult(res);
10741074

10751075
return their_head;
10761076
}
10771077
}
10781078

1079-
public static GitMergeHeadHandle git_merge_head_from_ref(RepositorySafeHandle repo, ReferenceSafeHandle reference)
1079+
public static GitAnnotatedCommitHandle git_annotated_commit_from_ref(RepositorySafeHandle repo, ReferenceSafeHandle reference)
10801080
{
10811081
using (ThreadAffinity())
10821082
{
1083-
GitMergeHeadHandle their_head;
1083+
GitAnnotatedCommitHandle their_head;
10841084

1085-
int res = NativeMethods.git_merge_head_from_ref(out their_head, repo, reference);
1085+
int res = NativeMethods.git_annotated_commit_from_ref(out their_head, repo, reference);
10861086

10871087
Ensure.ZeroResult(res);
10881088

10891089
return their_head;
10901090
}
10911091
}
10921092

1093-
public static ObjectId git_merge_head_id(GitMergeHeadHandle mergeHead)
1093+
public static ObjectId git_annotated_commit_id(GitAnnotatedCommitHandle mergeHead)
10941094
{
1095-
return NativeMethods.git_merge_head_id(mergeHead).MarshalAsObjectId();
1095+
return NativeMethods.git_annotated_commit_id(mergeHead).MarshalAsObjectId();
10961096
}
10971097

1098-
public static void git_merge(RepositorySafeHandle repo, GitMergeHeadHandle[] heads, GitMergeOpts mergeOptions, GitCheckoutOpts checkoutOptions)
1098+
public static void git_merge(RepositorySafeHandle repo, GitAnnotatedCommitHandle[] heads, GitMergeOpts mergeOptions, GitCheckoutOpts checkoutOptions)
10991099
{
11001100
using (ThreadAffinity())
11011101
{
@@ -1114,7 +1114,7 @@ public static void git_merge(RepositorySafeHandle repo, GitMergeHeadHandle[] hea
11141114

11151115
public static void git_merge_analysis(
11161116
RepositorySafeHandle repo,
1117-
GitMergeHeadHandle[] heads,
1117+
GitAnnotatedCommitHandle[] heads,
11181118
out GitMergeAnalysis analysis_out,
11191119
out GitMergePreference preference_out)
11201120
{
@@ -1133,9 +1133,9 @@ public static void git_merge_analysis(
11331133
}
11341134
}
11351135

1136-
public static void git_merge_head_free(IntPtr handle)
1136+
public static void git_annotated_commit_free(IntPtr handle)
11371137
{
1138-
NativeMethods.git_merge_head_free(handle);
1138+
NativeMethods.git_annotated_commit_free(handle);
11391139
}
11401140

11411141
#endregion
@@ -2125,39 +2125,38 @@ public static void git_remote_rename(RepositorySafeHandle repo, string name, str
21252125
{
21262126
using (ThreadAffinity())
21272127
{
2128-
using (RemoteSafeHandle remote = git_remote_load(repo, name, false))
2128+
if (callback == null)
21292129
{
2130-
if (remote == null)
2131-
{
2132-
return;
2133-
}
2130+
callback = problem => {};
2131+
}
21342132

2135-
if (callback == null)
2136-
{
2137-
callback = problem => {};
2138-
}
2133+
var array = new GitStrArrayNative();
21392134

2140-
var array = new GitStrArrayNative();
2135+
try
2136+
{
2137+
int res = NativeMethods.git_remote_rename(
2138+
ref array.Array,
2139+
repo,
2140+
name,
2141+
new_name);
21412142

2142-
try
2143+
if (res == (int)GitErrorCode.NotFound)
21432144
{
2144-
int res = NativeMethods.git_remote_rename(
2145-
ref array.Array,
2146-
remote,
2147-
new_name);
2145+
throw new NotFoundException(
2146+
string.Format("Remote '{0}' does not exist and cannot be renamed.", name));
2147+
}
21482148

2149-
Ensure.ZeroResult(res);
2149+
Ensure.ZeroResult(res);
21502150

2151-
foreach (var item in array.ReadStrings())
2152-
{
2153-
callback(item);
2154-
}
2155-
}
2156-
finally
2151+
foreach (var item in array.ReadStrings())
21572152
{
2158-
array.Dispose();
2153+
callback(item);
21592154
}
21602155
}
2156+
finally
2157+
{
2158+
array.Dispose();
2159+
}
21612160
}
21622161
}
21632162

@@ -2189,11 +2188,6 @@ public static string git_remote_url(RemoteSafeHandle remote)
21892188
return NativeMethods.git_remote_url(remote);
21902189
}
21912190

2192-
public static bool git_remote_supported_url(string url)
2193-
{
2194-
return NativeMethods.git_remote_supported_url(url);
2195-
}
2196-
21972191
#endregion
21982192

21992193
#region git_repository_

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<Compile Include="Core\Handles\ConfigurationIteratorSafeHandle.cs" />
118118
<Compile Include="Core\GitBlame.cs" />
119119
<Compile Include="Core\Handles\BlameSafeHandle.cs" />
120-
<Compile Include="Core\Handles\GitMergeHeadHandle.cs" />
120+
<Compile Include="Core\Handles\GitAnnotatedCommitHandle.cs" />
121121
<Compile Include="Core\PushTransferProgressCallbacks.cs" />
122122
<Compile Include="Core\PackbuilderCallbacks.cs" />
123123
<Compile Include="HistoryDivergence.cs" />

LibGit2Sharp/Remote.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,6 @@ public static bool IsValidName(string name)
105105
return Proxy.git_remote_is_valid_name(name);
106106
}
57AE
107107

108-
/// <summary>
109-
/// Determines if the proposed remote URL is supported by the library.
110-
/// </summary>
111-
/// <param name="url">The URL to be checked.</param>
112-
/// <returns>true if the url is supported; false otherwise.</returns>
113-
public static bool IsSupportedUrl(string url)
114-
{
115-
return Proxy.git_remote_supported_url(url);
116-
}
117-
118108
/// <summary>
119109
/// Determines whether the specified <see cref="Object"/> is equal to the current <see cref="Remote"/>.
120110
/// </summary>

0 commit comments

Comments
 (0)
0