Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70074f9

Browse files
committed
Get rid of GitRefSpecHandle
1 parentc0cf249 commit70074f9

File tree

8 files changed

+31
-35
lines changed

8 files changed

+31
-35
lines changed

‎LibGit2Sharp/Core/Handles/GitRefSpecHandle.cs‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎LibGit2Sharp/Core/NativeMethods.cs‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,31 +1110,31 @@ internal static extern IntPtr git_reflog_entry_committer(
11101110
internalstaticexternstringgit_reflog_entry_message(SafeHandleentry);
11111111

11121112
[DllImport(libgit2)]
1113-
internalstaticexternintgit_refspec_rtransform(
1113+
internalstaticexternunsafeintgit_refspec_rtransform(
11141114
GitBufbuf,
1115-
GitRefSpecHandlerefSpec,
1115+
git_refspec*refSpec,
11161116
[MarshalAs(UnmanagedType.CustomMarshaler,MarshalCookie=UniqueId.UniqueIdentifier,MarshalTypeRef=typeof(StrictUtf8Marshaler))]stringname);
11171117

11181118
[DllImport(libgit2)]
11191119
[return:MarshalAs(UnmanagedType.CustomMarshaler,MarshalCookie=UniqueId.UniqueIdentifier,MarshalTypeRef=typeof(LaxUtf8NoCleanupMarshaler))]
1120-
internalstaticexternstringgit_refspec_string(
1121-
GitRefSpecHandlerefSpec);
1120+
internalstaticexternunsafestringgit_refspec_string(
1121+
git_refspec*refSpec);
11221122

11231123
[DllImport(libgit2)]
1124-
internalstaticexternRefSpecDirectiongit_refspec_direction(GitRefSpecHandlerefSpec);
1124+
internalstaticexternunsafeRefSpecDirectiongit_refspec_direction(git_refspec*refSpec);
11251125

11261126
[DllImport(libgit2)]
11271127
[return:MarshalAs(UnmanagedType.CustomMarshaler,MarshalCookie=UniqueId.UniqueIdentifier,MarshalTypeRef=typeof(LaxUtf8NoCleanupMarshaler))]
1128-
internalstaticexternstringgit_refspec_dst(
1129-
GitRefSpecHandlerefSpec);
1128+
internalstaticexternunsafestringgit_refspec_dst(
1129+
git_refspec*refSpec);
11301130

11311131
[DllImport(libgit2)]
11321132
[return:MarshalAs(UnmanagedType.CustomMarshaler,MarshalCookie=UniqueId.UniqueIdentifier,MarshalTypeRef=typeof(LaxUtf8NoCleanupMarshaler))]
1133-
internalstaticexternstringgit_refspec_src(
1134-
GitRefSpecHandlerefSpec);
1133+
internalstaticexternunsafestringgit_refspec_src(
1134+
git_refspec*refSpec);
11351135

11361136
[DllImport(libgit2)]
1137-
internalstaticexternboolgit_refspec_force(GitRefSpecHandlerefSpec);
1137+
internalstaticexternunsafeboolgit_refspec_force(git_refspec*refSpec);
11381138

11391139
[DllImport(libgit2)]
11401140
internalstaticexternintgit_remote_autotag(RemoteSafeHandleremote);
@@ -1187,7 +1187,7 @@ internal static extern int git_remote_fetch(
11871187
internalstaticexternintgit_remote_get_fetch_refspecs(outGitStrArrayarray,RemoteSafeHandleremote);
11881188

11891189
[DllImport(libgit2)]
1190-
internalstaticexternGitRefSpecHandlegit_remote_get_refspec(RemoteSafeHandleremote,UIntPtrn);
1190+
internalstaticexternunsafegit_refspec*git_remote_get_refspec(RemoteSafeHandleremote,UIntPtrn);
11911191

11921192
[DllImport(libgit2)]
11931193
internalstaticexternintgit_remote_get_push_refspecs(outGitStrArrayarray,RemoteSafeHandleremote);

‎LibGit2Sharp/Core/Opaques.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ namespace LibGit2Sharp.Core
44
{
55
internalstructgit_tree_entry{}
66
internalstructgit_reference{}
7+
internalstructgit_refspec{}
78
}
89

‎LibGit2Sharp/Core/Proxy.cs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,7 +1990,7 @@ public static string git_reflog_entry_message(SafeHandle entry)
19901990

19911991
#region git_refspec
19921992

1993-
publicstaticstringgit_refspec_rtransform(GitRefSpecHandlerefSpecPtr,stringname)
1993+
publicstaticunsafestringgit_refspec_rtransform(git_refspec*refSpecPtr,stringname)
19941994
{
19951995
using(varbuf=newGitBuf())
19961996
{
@@ -2001,27 +2001,27 @@ public static string git_refspec_rtransform(GitRefSpecHandle refSpecPtr, string
20012001
}
20022002
}
20032003

2004-
publicstaticstringgit_refspec_string(GitRefSpecHandlerefSpec)
2004+
publicstaticunsafestringgit_refspec_string(git_refspec*refSpec)
20052005
{
20062006
returnNativeMethods.git_refspec_string(refSpec);
20072007
}
20082008

2009-
publicstaticstringgit_refspec_src(GitRefSpecHandlerefSpec)
2009+
publicstaticunsafestringgit_refspec_src(git_refspec*refSpec)
20102010
{
20112011
returnNativeMethods.git_refspec_src(refSpec);
20122012
}
20132013

2014-
publicstaticstringgit_refspec_dst(GitRefSpecHandlerefSpec)
2014+
publicstaticunsafestringgit_refspec_dst(git_refspec*refSpec)
20152015
{
20162016
returnNativeMethods.git_refspec_dst(refSpec);
20172017
}
20182018

2019-
publicstaticRefSpecDirectiongit_refspec_direction(GitRefSpecHandlerefSpec)
2019+
publicstaticunsafeRefSpecDirectiongit_refspec_direction(git_refspec*refSpec)
20202020
{
20212021
returnNativeMethods.git_refspec_direction(refSpec);
20222022
}
20232023

2024-
publicstaticboolgit_refspec_force(GitRefSpecHandlerefSpec)
2024+
publicstaticunsafeboolgit_refspec_force(git_refspec*refSpec)
20252025
{
20262026
returnNativeMethods.git_refspec_force(refSpec);
20272027
}
@@ -2089,7 +2089,7 @@ public static void git_remote_delete(RepositorySafeHandle repo, string name)
20892089
Ensure.ZeroResult(res);
20902090
}
20912091

2092-
publicstaticGitRefSpecHandlegit_remote_get_refspec(RemoteSafeHandleremote,intn)
2092+
publicstaticunsafegit_refspec*git_remote_get_refspec(RemoteSafeHandleremote,intn)
20932093
{
20942094
returnNativeMethods.git_remote_get_refspec(remote,(UIntPtr)n);
20952095
}

‎LibGit2Sharp/LibGit2Sharp.csproj‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@
192192
<CompileInclude="ConflictCollection.cs" />
193193
<CompileInclude="RemoteUpdater.cs" />
194194
<CompileInclude="RemoveFromIndexException.cs" />
195-
<CompileInclude="Core\Handles\GitRefSpecHandle.cs" />
196195
<CompileInclude="Core\Handles\NullRepositorySafeHandle.cs" />
197196
<CompileInclude="GitLink.cs" />
198197
<CompileInclude="Core\RepositoryOpenFlags.cs" />

‎LibGit2Sharp/RefSpec.cs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
usingSystem.Diagnostics;
1+
usingSystem;
2+
usingSystem.Diagnostics;
23
usingSystem.Globalization;
34
usingLibGit2Sharp.Core;
45
usingLibGit2Sharp.Core.Handles;
@@ -30,9 +31,12 @@ private RefSpec(string refSpec, RefSpecDirection direction, string source, strin
3031
protectedRefSpec()
3132
{}
3233

33-
internalstaticRefSpecBuildFromPtr(GitRefSpecHandlehandle)
34+
internalstaticunsafeRefSpecBuildFromPtr(git_refspec*handle)
3435
{
35-
Ensure.ArgumentNotNull(handle,"handle");
36+
if(handle==null)
37+
{
38+
thrownewArgumentNullException("handle");
39+
}
3640

3741
returnnewRefSpec(Proxy.git_refspec_string(handle),Proxy.git_refspec_direction(handle),
3842
Proxy.git_refspec_src(handle),Proxy.git_refspec_dst(handle),Proxy.git_refspec_force(handle));

‎LibGit2Sharp/RefSpecCollection.cs‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,15 @@ internal RefSpecCollection(RemoteSafeHandle handle)
2929
refspecs=RetrieveRefSpecs(handle);
3030
}
3131

32-
staticIList<RefSpec>RetrieveRefSpecs(RemoteSafeHandleremoteHandle)
32+
staticunsafeIList<RefSpec>RetrieveRefSpecs(RemoteSafeHandleremoteHandle)
3333
{
3434
intcount=Proxy.git_remote_refspec_count(remoteHandle);
3535
List<RefSpec>refSpecs=newList<RefSpec>();
3636

3737
for(inti=0;i<count;i++)
3838
{
39-
using(GitRefSpecHandlehandle=Proxy.git_remote_get_refspec(remoteHandle,i))
40-
{
41-
refSpecs.Add(RefSpec.BuildFromPtr(handle));
42-
}
39+
git_refspec*handle=Proxy.git_remote_get_refspec(remoteHandle,i);
40+
refSpecs.Add(RefSpec.BuildFromPtr(handle));
4341
}
4442

4543
returnrefSpecs;

‎LibGit2Sharp/Remote.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ public virtual IEnumerable<RefSpec> PushRefSpecs
9898
/// </summary>
9999
/// <param name="reference">The reference to transform.</param>
100100
/// <returns>The transformed reference.</returns>
101-
internalstringFetchSpecTransformToSource(stringreference)
101+
internalunsafestringFetchSpecTransformToSource(stringreference)
102102
{
103103
using(RemoteSafeHandleremoteHandle=Proxy.git_remote_lookup(repository.Handle,Name,true))
104104
{
105-
GitRefSpecHandlefetchSpecPtr=Proxy.git_remote_get_refspec(remoteHandle,0);
105+
git_refspec*fetchSpecPtr=Proxy.git_remote_get_refspec(remoteHandle,0);
106106
returnProxy.git_refspec_rtransform(fetchSpecPtr,reference);
107107
}
108108
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp