File tree Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -979,8 +979,8 @@ class Option(IntEnum):
979979 SET_PACK_MAX_OBJECTS = _pygit2 .GIT_OPT_SET_PACK_MAX_OBJECTS
980980 DISABLE_PACK_KEEP_FILE_CHECKS = _pygit2 .GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS
981981 # 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
984984 # SET_ODB_PACKED_PRIORITY = _pygit2.GIT_OPT_SET_ODB_PACKED_PRIORITY
985985 # SET_ODB_LOOSE_PRIORITY = _pygit2.GIT_OPT_SET_ODB_LOOSE_PRIORITY
986986 # 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)
141141 Py_RETURN_NONE ;
142142 }
143143
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+
144176 case GIT_OPT_GET_SEARCH_PATH :
145177 {
146178 PyObject * py_level ;
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ PyDoc_STRVAR(option__doc__,
5252 "GIT_OPT_SET_MWINDOW_SIZE, size\n"
5353 " Set the maximum mmap window size.\n"
5454 "\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"
5561 "GIT_OPT_GET_OWNER_VALIDATION\n"
5662 " Gets the owner validation setting for repository directories.\n"
5763 "\n"
Original file line number Diff line number Diff line change @@ -504,6 +504,8 @@ PyInit__pygit2(void)
504504 ADD_CONSTANT_INT (m , GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS );
505505 ADD_CONSTANT_INT (m , GIT_OPT_GET_OWNER_VALIDATION );
506506 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 );
507509
508510 /* Exceptions */
509511 ADD_EXC (m , GitError , NULL );
You can’t perform that action at this time.
0 commit comments