File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,19 @@ Repository_is_bare__get__(Repository *self)
264
264
}
265
265
266
266
267
+ PyDoc_STRVAR (Repository_is_shallow__doc__ ,
268
+ "Check if a repository is a shallow repository." );
269
+
270
+ PyObject *
271
+ Repository_is_shallow__get__ (Repository * self )
272
+ {
273
+ if (git_repository_is_shallow (self -> repo ) > 0 )
274
+ Py_RETURN_TRUE ;
275
+
276
+ Py_RETURN_FALSE ;
277
+ }
278
+
279
+
267
280
PyDoc_STRVAR (Repository_git_object_lookup_prefix__doc__ ,
268
281
"git_object_lookup_prefix(oid) -> Object\n"
269
282
"\n"
@@ -2130,6 +2143,7 @@ PyGetSetDef Repository_getseters[] = {
2130
2143
GETTER (Repository , head_is_unborn ),
2131
2144
GETTER (Repository , is_empty ),
2132
2145
GETTER (Repository , is_bare ),
2146
+ GETTER (Repository , is_shallow ),
2133
2147
GETSET (Repository , workdir ),
2134
2148
GETTER (Repository , default_signature ),
2135
2149
GETTER (Repository , odb ),
Original file line number Diff line number Diff line change @@ -633,3 +633,12 @@ def test_open_extended(tmp_path):
633
633
assert repo .is_bare
634
634
assert repo .path == orig_repo .path
635
635
assert not repo .workdir
636
+
637
+ def test_is_shallow (testrepo ):
638
+ assert not testrepo .is_shallow
639
+
640
+ # create a dummy shallow file
641
+ with open (os .path .join (testrepo .path , 'shallow' ), 'wt' ) as f :
642
+ f .write ('abcdef0123456789abcdef0123456789abcdef00\n ' )
643
+
644
+ assert testrepo .is_shallow
You can’t perform that action at this time.
0 commit comments