-
Notifications
You must be signed in to change notification settings - Fork 899
Custom filter Streams #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom filter Streams #946
Conversation
Marshal.Copy(bytes, 0, reverseBytesPointer, bytes.Length); | ||
|
||
var size = (UIntPtr)length; | ||
var allocatedSize = (UIntPtr)length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In @ammeep's original implementation this was (UIntPtr)bytes.LongLength + 1
. Based on the AllocHGlobal()
call above this seems more correct, but I thought I'd call it out.
/// <summary> | ||
/// The allocated size of the underlying stream | ||
/// </summary> | ||
public long Allocated { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth mentioning that this is exposed as GitBufReadStream.Capacity
, and Size
exposed as GitBufReadStream.Length
.
{ | ||
base.Dispose(disposing); | ||
|
||
if (disposing && gitBuf != default(GitBuf)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to 🔥 this.
You can't dispose of the underlying git_buf. Libgit2 allocates two of these for the entire filter chain and swaps the input and output as it moves between filters in the registry. It also free's the buffers after the filter registry has been executed. This is why the tests are failing on this branch 😄
Filters stream rebound
…ilters Conflicts: LibGit2Sharp.Tests/TestHelpers/SubstitutionCipherFilter.cs LibGit2Sharp/GitBufReader.cs
Thank you so much @dahlbyk and @nulltoken for all your hard work on this. I really appreciate the input 😍 |
As discussed, this switches
Filter
to support reading/writingBlob
content usingStream
s instead ofbyte[]
.