Skip to content

Commit 522a716

Browse files
committed
rewrite filter/stream callbacks in C
1 parent fb42553 commit 522a716

File tree

10 files changed

+704
-498
lines changed

10 files changed

+704
-498
lines changed

pygit2/__init__.py

+1-13
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from .credentials import *
3939
from .errors import check_error, Passthrough
4040
from .ffi import ffi, C
41-
from .filter import Filter, FilterSource, filter_register, filter_unregister
41+
from .filter import Filter
4242
from .index import Index, IndexEntry
4343
from .remote import Remote
4444
from .repository import Repository
@@ -119,18 +119,6 @@
119119
GIT_STASH_APPLY_PROGRESS_CHECKOUT_MODIFIED : int = C.GIT_STASH_APPLY_PROGRESS_CHECKOUT_MODIFIED
120120
GIT_STASH_APPLY_PROGRESS_DONE : int = C.GIT_STASH_APPLY_PROGRESS_DONE
121121

122-
# GIT_FILTER
123-
GIT_FILTER_TO_WORKTREE : int = C.GIT_FILTER_TO_WORKTREE
124-
GIT_FILTER_SMUDGE : int = C.GIT_FILTER_SMUDGE
125-
GIT_FILTER_TO_ODB : int = C.GIT_FILTER_TO_ODB
126-
GIT_FILTER_CLEAN : int = C.GIT_FILTER_CLEAN
127-
GIT_FILTER_DRIVER_PRIORITY : int = C.GIT_FILTER_DRIVER_PRIORITY
128-
GIT_FILTER_DEFAULT : int = C.GIT_FILTER_DEFAULT
129-
GIT_FILTER_ALLOW_UNSAFE : int = C.GIT_FILTER_ALLOW_UNSAFE
130-
GIT_FILTER_NO_SYSTEM_ATTRIBUTES : int = C.GIT_FILTER_NO_SYSTEM_ATTRIBUTES
131-
GIT_FILTER_ATTRIBUTES_FROM_HEAD : int = C.GIT_FILTER_ATTRIBUTES_FROM_HEAD
132-
GIT_FILTER_ATTRIBUTES_FROM_COMMIT : int = C.GIT_FILTER_ATTRIBUTES_FROM_COMMIT
133-
134122
# libgit version tuple
135123
LIBGIT2_VER = (LIBGIT2_VER_MAJOR, LIBGIT2_VER_MINOR, LIBGIT2_VER_REVISION)
136124

pygit2/_run.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
'revert.h',
8282
'stash.h',
8383
'submodule.h',
84-
'filter.h',
8584
'callbacks.h', # Bridge from libgit2 to Python
8685
]
8786
h_source = []
@@ -97,7 +96,7 @@
9796
ffi = FFI()
9897
ffi.set_source(
9998
"pygit2._libgit2",
100-
"#include <git2.h>\n#include <git2/sys/filter.h>", # preamble
99+
"#include <git2.h>", # preamble
101100
**libgit2_kw
102101
)
103102
ffi.cdef(C_HEADER_SRC)

pygit2/decl/callbacks.h

-28
Original file line numberDiff line numberDiff line change
@@ -65,31 +65,3 @@ extern "Python" void _checkout_progress_cb(
6565
extern "Python" int _stash_apply_progress_cb(
6666
git_stash_apply_progress_t progress,
6767
void *payload);
68-
69-
extern "Python" void _filter_shutdown_cb(git_filter *self);
70-
71-
extern "Python" int _filter_check_cb(
72-
git_filter *self,
73-
void **payload,
74-
const git_filter_source *src,
75-
const char **attr_values);
76-
77-
extern "Python" int _filter_stream_cb(
78-
git_writestream **out,
79-
git_filter *self,
80-
void **payload,
81-
const git_filter_source *src,
82-
git_writestream *next);
83-
84-
extern "Python" void _filter_cleanup_cb(
85-
git_filter *self,
86-
void *payload);
87-
88-
extern "Python" int _writestream_write_cb(
89-
git_writestream *stream,
90-
const char *buffer,
91-
size_t len);
92-
93-
extern "Python" int _writestream_close_cb(git_writestream *stream);
94-
95-
extern "Python" void _writestream_free_cb(git_writestream *stream);

pygit2/decl/filter.h

-68
This file was deleted.

pygit2/decl/types.h

-7
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ typedef struct git_submodule git_submodule;
1212
typedef struct git_transport git_transport;
1313
typedef struct git_tree git_tree;
1414
typedef struct git_packbuilder git_packbuilder;
15-
typedef struct git_writestream git_writestream;
16-
17-
struct git_writestream {
18-
int (*write)(git_writestream *stream, const char *buffer, size_t len);
19-
int (*close)(git_writestream *stream);
20-
void (*free)(git_writestream *stream);
21-
};
2215

2316
typedef int64_t git_off_t;
2417
typedef int64_t git_time_t;

0 commit comments

Comments
 (0)