Skip to content

Conversation

@jorio
Copy link
Contributor

@jorio jorio commented Dec 29, 2025

This PR adds support for the main git_filter_list features in libgit2.

pygit2 interface for libgit2 function
Repository.load_filter_list git_filter_list_load
FilterList.apply_to_buffer git_filter_list_apply_to_buffer
FilterList.apply_to_file git_filter_list_apply_to_file
FilterList.apply_to_blob git_filter_list_apply_to_blob
FilterList.__contains__ git_filter_list_contains
FilterList.__len__ git_filter_list_length

Important note: filter_unregister already exists in pygit2. Unregistering a filter while it's still in use in a FilterList would cause undefined behavior in libgit2. To prevent this, filter_unregister checks that the filter isn't in use in any live FilterLists before proceeding - otherwise, it raises RuntimeError. (To do so, I moved the implementation for filter_unregister from C to Python.)

@jorio jorio force-pushed the filterlist branch 2 times, most recently from ad2fcfb to 7233a0e Compare December 29, 2025 00:35
@jorio jorio marked this pull request as draft December 29, 2025 01:18
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.

1 participant