Skip to content

Commit b3878f1

Browse files
committed
These types will be dead soon. But appveyor doesnt want them in this namespace.
1 parent 99e1f6a commit b3878f1

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed

LibGit2Sharp/Core/GitBufWriter.cs renamed to LibGit2Sharp/GitBufReader.cs

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,11 @@
11
using System;
22
using System.Globalization;
33
using System.IO;
4-
using System.Runtime.InteropServices;
4+
using LibGit2Sharp.Core;
55
using LibGit2Sharp.Core.Handles;
66

7-
namespace LibGit2Sharp.Core
7+
namespace LibGit2Sharp
88
{
9-
/// <summary>
10-
/// Writes data to a <see cref="GitBuf"/> pointer
11-
/// </summary>
12-
public class GitBufWriter
13-
{
14-
private readonly IntPtr gitBufPointer;
15-
private readonly GitBuf gitBuf;
16-
17-
internal GitBufWriter(IntPtr gitBufPointer)
18-
{
19-
this.gitBufPointer = gitBufPointer;
20-
this.gitBuf = gitBufPointer.MarshalAs<GitBuf>();
21-
}
22-
23-
/// <summary>
24-
/// Write bytes to the <see cref="GitBuf"/> pointer
25-
/// </summary>
26-
/// <param name="bytes">The bytes to write</param>
27-
public void Write(byte[] bytes)
28-
{
29-
IntPtr reverseBytesPointer = Marshal.AllocHGlobal(bytes.Length);
30-
Marshal.Copy(bytes, 0, reverseBytesPointer, bytes.Length);
31-
32-
var size = (UIntPtr)bytes.LongLength;
33-
var allocatedSize = (UIntPtr)bytes.LongLength + 1;
34-
NativeMethods.git_buf_set(gitBuf, reverseBytesPointer, size);
35-
gitBuf.size = size;
36-
gitBuf.asize = allocatedSize;
37-
38-
Marshal.StructureToPtr(gitBuf, gitBufPointer, true);
39-
}
40-
}
41-
429
/// <summary>
4310
/// Reads data from a <see cref="GitBuf"/> pointer
4411
/// </summary>

LibGit2Sharp/GitBufWriter.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
using LibGit2Sharp.Core;
4+
using LibGit2Sharp.Core.Handles;
5+
6+
namespace LibGit2Sharp
7+
{
8+
/// <summary>
9+
/// Writes data to a <see cref="GitBuf"/> pointer
10+
/// </summary>
11+
public class GitBufWriter
12+
{
13+
private readonly IntPtr gitBufPointer;
14+
private readonly GitBuf gitBuf;
15+
16+
internal GitBufWriter(IntPtr gitBufPointer)
17+
{
18+
this.gitBufPointer = gitBufPointer;
19+
this.gitBuf = gitBufPointer.MarshalAs<GitBuf>();
20+
}
21+
22+
/// <summary>
23+
/// Write bytes to the <see cref="GitBuf"/> pointer
24+
/// </summary>
25+
/// <param name="bytes">The bytes to write</param>
26+
public void Write(byte[] bytes)
27+
{
28+
IntPtr reverseBytesPointer = Marshal.AllocHGlobal(bytes.Length);
29+
Marshal.Copy(bytes, 0, reverseBytesPointer, bytes.Length);
30+
31+
var size = (UIntPtr)bytes.LongLength;
32+
var allocatedSize = (UIntPtr)bytes.LongLength + 1;
33+
NativeMethods.git_buf_set(gitBuf, reverseBytesPointer, size);
34+
gitBuf.size = size;
35+
gitBuf.asize = allocatedSize;
36+
37+
Marshal.StructureToPtr(gitBuf, gitBufPointer, true);
38+
}
39+
}
40+
}

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
<Compile Include="CommitOptions.cs" />
6969
<Compile Include="CommitSortStrategies.cs" />
7070
<Compile Include="CompareOptions.cs" />
71-
<Compile Include="Core\GitBufWriter.cs" />
7271
<Compile Include="Core\GitFilter.cs" />
7372
<Compile Include="Core\GitIndexReucEntry.cs" />
7473
<Compile Include="Core\Handles\GitFilterSafeHandle.cs" />
@@ -83,6 +82,8 @@
8382
<Compile Include="FetchOptionsBase.cs" />
8483
<Compile Include="FilterMode.cs" />
8584
<Compile Include="FilterSource.cs" />
85+
<Compile Include="GitBufReader.cs" />
86+
<Compile Include="GitBufWriter.cs" />
8687
<Compile Include="IBelongToARepository.cs" />
8788
<Compile Include="Filter.cs" />
8889
<Compile Include="IndexNameEntryCollection.cs" />

0 commit comments

Comments
 (0)