Skip to content

No more check function#968

Merged
ammeep merged 4 commits into
register-custom-filtersfrom
no-more-check-function
Feb 26, 2015
Merged

No more check function#968
ammeep merged 4 commits into
register-custom-filtersfrom
no-more-check-function

Conversation

@ammeep

@ammeep ammeep commented Feb 20, 2015

Copy link
Copy Markdown
Member

This PR removes the need to supply the check callback when registering a Filter with the library.

For example if you want to install a filter with libgit2 with the name foo you would register that filter with libgit2sharp and it would be applied to any file that matched the path spec found in the gitattributes file. For example *.txt filter=foo

I naively thought that we needed to implement custom check logic for filters (the piece that actually matches the entry in the attributes file to the file being filtered) but it turns out this is already implemented in libgit2 https://github.com/libgit2/libgit2/blob/master/src/filter.c#L403 and if we simply do not provide the optional check callback, everything just works ™️

I've added an object FilterAttribute which allows you to define and register a filter in the correct format filter=name

@ammeep

ammeep commented Feb 21, 2015

Copy link
Copy Markdown
Member Author

I would love some eyes on this @nulltoken.

Want to make sure it is sane before I merge it, squash down the register filter PR, and update libgit2 to the latest 💅

Comment thread LibGit2Sharp/Filter.cs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Just use the linq inside the initializer list?

ammeep pushed a commit that referenced this pull request Feb 26, 2015
@ammeep
ammeep merged commit f0f5a46 into register-custom-filters Feb 26, 2015
@ammeep
ammeep deleted the no-more-check-function branch February 26, 2015 23:30
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.

2 participants