Skip to content

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

Merged
merged 27 commits into from
Feb 13, 2015
Merged

Conversation

dahlbyk
Copy link
Member

@dahlbyk dahlbyk commented Feb 10, 2015

As discussed, this switches Filter to support reading/writing Blob content using Streams instead of byte[].

@dahlbyk dahlbyk changed the title Custom filter streams Custom filter Streams Feb 10, 2015
Marshal.Copy(bytes, 0, reverseBytesPointer, bytes.Length);

var size = (UIntPtr)length;
var allocatedSize = (UIntPtr)length;
Copy link
Member Author

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; }
Copy link
Member Author

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.

@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 10, 2015

/cc @nulltoken @carlosmn @ethomson

@nulltoken nulltoken mentioned this pull request Feb 10, 2015
@nulltoken
Copy link
Member

@dahlbyk I've forced AppVeyor to build your branch. Seems we suffer from the same issue in both #946 and #948

{
base.Dispose(disposing);

if (disposing && gitBuf != default(GitBuf))
Copy link
Member

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 😄

nulltoken and others added 5 commits February 12, 2015 09:04
ammeep pushed a commit that referenced this pull request Feb 13, 2015
@ammeep ammeep merged commit 275afda into register-custom-filters Feb 13, 2015
@ammeep ammeep deleted the dahlbyk/register-custom-filters branch February 13, 2015 20:48
@ammeep
Copy link
Member

ammeep commented Feb 13, 2015

Thank you so much @dahlbyk and @nulltoken for all your hard work on this. I really appreciate the input 😍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants