@@ -72,52 +72,6 @@ option(PyObject *self, PyObject *args)
7272 option = PyInt_AsLong (py_option );
7373
7474 switch (option ) {
75- case GIT_OPT_GET_SEARCH_PATH :
76- {
77- PyObject * py_level ;
78-
79- py_level = PyTuple_GetItem (args , 1 );
80- if (!py_level )
81- return NULL ;
82-
83- if (!PyInt_Check (py_level ))
84- return Error_type_error (
85- "level should be an integer, got %.200s" , py_level );
86-
87- return get_search_path (PyInt_AsLong (py_level ));
88- }
89-
90- case GIT_OPT_SET_SEARCH_PATH :
91- {
92- PyObject * py_level , * py_path , * tpath ;
93- const char * path ;
94- int err ;
95-
96- py_level = PyTuple_GetItem (args , 1 );
97- if (!py_level )
98- return NULL ;
99-
100- py_path = PyTuple_GetItem (args , 2 );
101- if (!py_path )
102- return NULL ;
103-
104- if (!PyInt_Check (py_level ))
105- return Error_type_error (
106- "level should be an integer, got %.200s" , py_level );
107-
108- path = py_str_borrow_c_str (& tpath , py_path , NULL );
109- if (!path )
110- return NULL ;
111-
112- err = git_libgit2_opts (
113- GIT_OPT_SET_SEARCH_PATH , PyInt_AsLong (py_level ), path );
114- Py_DECREF (tpath );
115-
116- if (err < 0 )
117- return Error_set (err );
118-
119- Py_RETURN_NONE ;
120- }
12175
12276 case GIT_OPT_GET_MWINDOW_SIZE :
12377 {
@@ -187,6 +141,53 @@ option(PyObject *self, PyObject *args)
187141 Py_RETURN_NONE ;
188142 }
189143
144+ case GIT_OPT_GET_SEARCH_PATH :
145+ {
146+ PyObject * py_level ;
147+
148+ py_level = PyTuple_GetItem (args , 1 );
149+ if (!py_level )
150+ return NULL ;
151+
152+ if (!PyInt_Check (py_level ))
153+ return Error_type_error (
154+ "level should be an integer, got %.200s" , py_level );
155+
156+ return get_search_path (PyInt_AsLong (py_level ));
157+ }
158+
159+ case GIT_OPT_SET_SEARCH_PATH :
160+ {
161+ PyObject * py_level , * py_path , * tpath ;
162+ const char * path ;
163+ int err ;
164+
165+ py_level = PyTuple_GetItem (args , 1 );
166+ if (!py_level )
167+ return NULL ;
168+
169+ py_path = PyTuple_GetItem (args , 2 );
170+ if (!py_path )
171+ return NULL ;
172+
173+ if (!PyInt_Check (py_level ))
174+ return Error_type_error (
175+ "level should be an integer, got %.200s" , py_level );
176+
177+ path = py_str_borrow_c_str (& tpath , py_path , NULL );
178+ if (!path )
179+ return NULL ;
180+
181+ err = git_libgit2_opts (
182+ GIT_OPT_SET_SEARCH_PATH , PyInt_AsLong (py_level ), path );
183+ Py_DECREF (tpath );
184+
185+ if (err < 0 )
186+ return Error_set (err );
187+
188+ Py_RETURN_NONE ;
189+ }
190+
190191 case GIT_OPT_SET_CACHE_OBJECT_LIMIT :
191192 {
192193 size_t limit ;
@@ -237,25 +238,6 @@ option(PyObject *self, PyObject *args)
237238 Py_RETURN_NONE ;
238239 }
239240
240- case GIT_OPT_ENABLE_CACHING :
241- {
242- int flag ;
243- PyObject * py_flag ;
244-
245- py_flag = PyTuple_GetItem (args , 1 );
246-
247- if (!PyInt_Check (py_flag ))
248- return Error_type_error (
249- "flag should be an integer, got %.200s" , py_flag );
250-
251- flag = PyInt_AsSize_t (py_flag );
252- error = git_libgit2_opts (GIT_OPT_ENABLE_CACHING , flag );
253- if (error < 0 )
254- return Error_set (error );
255-
256- Py_RETURN_NONE ;
257- }
258-
259241 case GIT_OPT_GET_CACHED_MEMORY :
260242 {
261243 size_t current ;
@@ -302,6 +284,49 @@ option(PyObject *self, PyObject *args)
302284 Py_RETURN_NONE ;
303285 }
304286
287+ // int enabled
288+ case GIT_OPT_ENABLE_CACHING :
289+ case GIT_OPT_ENABLE_STRICT_OBJECT_CREATION :
290+ case GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION :
291+ case GIT_OPT_ENABLE_OFS_DELTA :
292+ case GIT_OPT_ENABLE_FSYNC_GITDIR :
293+ case GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION :
294+ case GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY :
295+ {
296+ PyObject * py_enabled ;
297+ int enabled ;
298+
299+ py_enabled = PyTuple_GetItem (args , 1 );
300+ if (!py_enabled )
301+ return NULL ;
302+
303+ if (!PyInt_Check (py_enabled ))
304+ return Error_type_error ("expected integer, got %.200s" , py_enabled );
305+
306+ enabled = PyInt_AsSize_t (py_enabled );
307+ error = git_libgit2_opts (option , enabled );
308+ if (error < 0 )
309+ return Error_set (error );
310+
311+ Py_RETURN_NONE ;
312+ }
313+
314+ // Not implemented
315+ case GIT_OPT_GET_TEMPLATE_PATH :
316+ case GIT_OPT_SET_TEMPLATE_PATH :
317+ case GIT_OPT_SET_USER_AGENT :
318+ case GIT_OPT_SET_SSL_CIPHERS :
319+ case GIT_OPT_GET_USER_AGENT :
320+ case GIT_OPT_GET_WINDOWS_SHAREMODE :
321+ case GIT_OPT_SET_WINDOWS_SHAREMODE :
322+ case GIT_OPT_SET_ALLOCATOR :
323+ case GIT_OPT_GET_PACK_MAX_OBJECTS :
324+ case GIT_OPT_SET_PACK_MAX_OBJECTS :
325+ {
326+ Py_INCREF (Py_NotImplemented );
327+ return Py_NotImplemented ;
328+ }
329+
305330 }
306331
307332 PyErr_SetString (PyExc_ValueError , "unknown/unsupported option value" );
0 commit comments