File tree 4 files changed +42
-2
lines changed
4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -979,8 +979,8 @@ class Option(IntEnum):
979
979
SET_PACK_MAX_OBJECTS = _pygit2 .GIT_OPT_SET_PACK_MAX_OBJECTS
980
980
DISABLE_PACK_KEEP_FILE_CHECKS = _pygit2 .GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS
981
981
# ENABLE_HTTP_EXPECT_CONTINUE = _pygit2.GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE
982
- # GET_MWINDOW_FILE_LIMIT = _pygit2.GIT_OPT_GET_MWINDOW_FILE_LIMIT
983
- # SET_MWINDOW_FILE_LIMIT = _pygit2.GIT_OPT_SET_MWINDOW_FILE_LIMIT
982
+ GET_MWINDOW_FILE_LIMIT = _pygit2 .GIT_OPT_GET_MWINDOW_FILE_LIMIT
983
+ SET_MWINDOW_FILE_LIMIT = _pygit2 .GIT_OPT_SET_MWINDOW_FILE_LIMIT
984
984
# SET_ODB_PACKED_PRIORITY = _pygit2.GIT_OPT_SET_ODB_PACKED_PRIORITY
985
985
# SET_ODB_LOOSE_PRIORITY = _pygit2.GIT_OPT_SET_ODB_LOOSE_PRIORITY
986
986
# GET_EXTENSIONS = _pygit2.GIT_OPT_GET_EXTENSIONS
Original file line number Diff line number Diff line change @@ -141,6 +141,38 @@ option(PyObject *self, PyObject *args)
141
141
Py_RETURN_NONE ;
142
142
}
143
143
144
+ case GIT_OPT_GET_MWINDOW_FILE_LIMIT :
145
+ {
146
+ size_t limit ;
147
+
148
+ error = git_libgit2_opts (GIT_OPT_GET_MWINDOW_FILE_LIMIT , & limit );
149
+ if (error < 0 )
150
+ return Error_set (error );
151
+
152
+ return PyLong_FromSize_t (limit );
153
+ }
154
+
155
+ case GIT_OPT_SET_MWINDOW_FILE_LIMIT :
156
+ {
157
+ size_t limit ;
158
+ PyObject * py_limit ;
159
+
160
+ py_limit = PyTuple_GetItem (args , 1 );
161
+ if (!py_limit )
162
+ return NULL ;
163
+
164
+ if (!PyLong_Check (py_limit ))
165
+ return Error_type_error (
166
+ "size should be an integer, got %.200s" , py_limit );
167
+
168
+ limit = PyLong_AsSize_t (py_limit );
169
+ error = git_libgit2_opts (GIT_OPT_SET_MWINDOW_SIZE , limit );
170
+ if (error < 0 )
171
+ return Error_set (error );
172
+
173
+ Py_RETURN_NONE ;
174
+ }
175
+
144
176
case GIT_OPT_GET_SEARCH_PATH :
145
177
{
146
178
PyObject * py_level ;
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ PyDoc_STRVAR(option__doc__,
52
52
"GIT_OPT_SET_MWINDOW_SIZE, size\n"
53
53
" Set the maximum mmap window size.\n"
54
54
"\n"
55
+ "GIT_OPT_GET_MWINDOW_FILE_LIMIT\n"
56
+ " Get the maximum number of files that will be mapped at any time by the library.\n"
57
+ "\n"
58
+ "GIT_OPT_SET_MWINDOW_FILE_LIMIT, size\n"
59
+ " Set the maximum number of files that can be mapped at any time by the library. The default (0) is unlimited.\n"
60
+ "\n"
55
61
"GIT_OPT_GET_OWNER_VALIDATION\n"
56
62
" Gets the owner validation setting for repository directories.\n"
57
63
"\n"
Original file line number Diff line number Diff line change @@ -504,6 +504,8 @@ PyInit__pygit2(void)
504
504
ADD_CONSTANT_INT (m , GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS );
505
505
ADD_CONSTANT_INT (m , GIT_OPT_GET_OWNER_VALIDATION );
506
506
ADD_CONSTANT_INT (m , GIT_OPT_SET_OWNER_VALIDATION );
507
+ ADD_CONSTANT_INT (m , GIT_OPT_GET_MWINDOW_FILE_LIMIT );
508
+ ADD_CONSTANT_INT (m , GIT_OPT_SET_MWINDOW_FILE_LIMIT );
507
509
508
510
/* Exceptions */
509
511
ADD_EXC (m , GitError , NULL );
You can’t perform that action at this time.
0 commit comments