Skip to content

Commit 763c45b

Browse files
committed
fixup! Moar
1 parent 44cfa26 commit 763c45b

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

LibGit2Sharp/ObjectDatabase.cs

+18-4
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ public virtual void AddBackend(OdbBackend backend, int priority)
131131
private class Processor
132132
{
133133
private readonly Stream stream;
134-
private readonly int? numberOfBytesToConsume;
134+
private readonly long? numberOfBytesToConsume;
135135
private int totalNumberOfReadBytes;
136136

137-
public Processor(Stream stream, int? numberOfBytesToConsume)
137+
public Processor(Stream stream, long? numberOfBytesToConsume)
138138
{
139139
this.stream = stream;
140140
this.numberOfBytesToConsume = numberOfBytesToConsume;
@@ -148,11 +148,11 @@ public int Provider(IntPtr content, int max_length, IntPtr data)
148148

149149
if (numberOfBytesToConsume.HasValue)
150150
{
151-
int totalRemainingBytesToRead = numberOfBytesToConsume.Value - totalNumberOfReadBytes;
151+
long totalRemainingBytesToRead = numberOfBytesToConsume.Value - totalNumberOfReadBytes;
152152

153153
if (totalRemainingBytesToRead < max_length)
154154
{
155-
bytesToRead = totalRemainingBytesToRead;
155+
bytesToRead = totalRemainingBytesToRead > int.MaxValue ? int.MaxValue : (int)totalRemainingBytesToRead;
156156
}
157157
}
158158

@@ -185,7 +185,21 @@ public int Provider(IntPtr content, int max_length, IntPtr data)
185185
/// <param name="hintpath">The hintpath is used to determine what git filters should be applied to the object before it can be placed to the object database.</param>
186186
/// <param name="numberOfBytesToConsume">The number of bytes to consume from the stream.</param>
187187
/// <returns>The created <see cref="Blob"/>.</returns>
188+
[Obsolete("This method will be removed in the next release. Please use CreateBlob(Stream stream, long) instead.")]
188189
public virtual Blob CreateBlob(Stream stream, string hintpath = null, int? numberOfBytesToConsume = null)
190+
{
191+
return CreateBlob(stream, hintpath, (long?)numberOfBytesToConsume);
192+
}
193+
194+
/// <summary>
195+
/// Inserts a <see cref="Blob"/> into the object database, created from the content of a stream.
196+
/// <para>Optionally, git filters will be applied to the content before storing it.</para>
197+
/// </summary>
198+
/// <param name="stream">The stream from which will be read the content of the blob to be created.</param>
199+
/// <param name="hintpath">The hintpath is used to determine what git filters should be applied to the object before it can be placed to the object database.</param>
200+
/// <param name="numberOfBytesToConsume">The number of bytes to consume from the stream.</param>
201+
/// <returns>The created <see cref="Blob"/>.</returns>
202+
public virtual Blob CreateBlob(Stream stream, string hintpath = null, long? numberOfBytesToConsume = null)
189203
{
190204
Ensure.ArgumentNotNull(stream, "stream");
191205

LibGit2Sharp/RemoteUpdater.cs

+8-4
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,26 @@ internal RemoteUpdater(Repository repo, Remote remote)
3636

3737
private IEnumerable<string> GetFetchRefSpecs()
3838
{
39-
return Proxy.git_remote_get_fetch_refspecs(remoteHandle);
39+
throw new NotImplementedException();
40+
//return Proxy.git_remote_get_fetch_refspecs(remoteHandle);
4041
}
4142

4243
private void SetFetchRefSpecs(IEnumerable<string> value)
4344
{
44-
Proxy.git_remote_set_fetch_refspecs(remoteHandle, value);
45+
throw new NotImplementedException();
46+
//Proxy.git_remote_set_fetch_refspecs(remoteHandle, value);
4547
}
4648

4749
private IEnumerable<string> GetPushRefSpecs()
4850
{
49-
return Proxy.git_remote_get_push_refspecs(remoteHandle);
51+
throw new NotImplementedException();
52+
//return Proxy.git_remote_get_push_refspecs(remoteHandle);
5053
}
5154

5255
private void SetPushRefSpecs(IEnumerable<string> value)
5356
{
54-
Proxy.git_remote_set_push_refspecs(remoteHandle, value);
57+
throw new NotImplementedException();
58+
//Proxy.git_remote_set_push_refspecs(remoteHandle, value);
5559
}
5660

5761
/// <summary>

0 commit comments

Comments
 (0)