@@ -96,6 +96,7 @@ def clone(
9696 cache_directory : Optional [str ] = None ,
9797 reference : Optional [str ] = None ,
9898 reference_if_able : Optional [str ] = None ,
99+ depth : Optional [int ] = None ,
99100 ssh_private_key_path : Optional [str ] = None ,
100101 ssh_strict_host_key_checking : bool = True ,
101102 ) -> str :
@@ -183,6 +184,9 @@ def clone(
183184 # we want to make the newly cloned repo to be independent, this stops borrowing the objects
184185 cmd += ["--dissociate" ]
185186
187+ if depth :
188+ cmd += ["--depth" , str (depth )]
189+
186190 if quiet :
187191 cmd += ["--quiet" ]
188192
@@ -222,6 +226,7 @@ def clone_or_update(
222226 cache_directory : Optional [str ] = None ,
223227 reference : Optional [str ] = None ,
224228 reference_if_able : Optional [str ] = None ,
229+ depth : Optional [int ] = None ,
225230 remote : Optional [str ] = None ,
226231 ssh_private_key_path : Optional [str ] = None ,
227232 ):
@@ -237,6 +242,7 @@ def clone_or_update(
237242 cache_directory = cache_directory ,
238243 reference = reference ,
239244 reference_if_able = reference_if_able ,
245+ depth = depth ,
240246 ssh_private_key_path = ssh_private_key_path ,
241247 )
242248
@@ -250,7 +256,7 @@ def clone_or_update(
250256 # without it, ``git submodule status`` is broken and returns old data
251257 git .reset ()
252258 # checkout the pull request and check if HEAD matches head/sha from Gitea
253- pr_branch = git .fetch_pull_request (pr_number , commit = commit , force = True )
259+ pr_branch = git .fetch_pull_request (pr_number , commit = commit , depth = depth , force = True )
254260 git .switch (pr_branch )
255261 head_commit = git .get_branch_head ()
256262 assert (
0 commit comments