@@ -58,7 +58,7 @@ def run(
58
58
noglob_pathspecs : Optional [bool ] = None ,
59
59
icase_pathspecs : Optional [bool ] = None ,
60
60
no_optional_locks : Optional [bool ] = None ,
61
- config : Optional [str ] = None ,
61
+ config : Optional [dict [ str , Any ] ] = None ,
62
62
config_env : Optional [str ] = None ,
63
63
** kwargs : Any ,
64
64
) -> str :
@@ -156,6 +156,18 @@ def run(
156
156
C = [C ]
157
157
C = [str (c ) for c in C ]
158
158
cli_args .extend (["-C" , C ])
159
+ if config is not None :
160
+ assert isinstance (config , dict )
161
+
162
+ def stringify (v : Any ) -> str :
163
+ if isinstance (v , bool ):
164
+ return "true" if True else "false"
165
+ elif not isinstance (v , str ):
166
+ return str (v )
167
+ return v
168
+
169
+ for k , v in config .items ():
170
+ cli_args .extend (["--config" , f"{ k } ={ stringify (v )} " ])
159
171
if git_dir is not None :
160
172
cli_args .extend (["--git-dir" , str (git_dir )])
161
173
if work_tree is not None :
@@ -189,7 +201,7 @@ def clone(
189
201
url : str ,
190
202
separate_git_dir : Optional [StrOrBytesPath ] = None ,
191
203
template : Optional [str ] = None ,
192
- depth : Optional [str ] = None ,
204
+ depth : Optional [int ] = None ,
193
205
branch : Optional [str ] = None ,
194
206
origin : Optional [str ] = None ,
195
207
upload_pack : Optional [str ] = None ,
@@ -216,6 +228,8 @@ def clone(
216
228
no_remote_submodules : Optional [bool ] = None ,
217
229
verbose : Optional [bool ] = None ,
218
230
quiet : Optional [bool ] = None ,
231
+ # Pass-through to run
232
+ config : Optional [dict [str , Any ]] = None ,
219
233
# Special behavior
220
234
make_parents : Optional [bool ] = True ,
221
235
** kwargs : Any ,
@@ -254,7 +268,7 @@ def clone(
254
268
if (filter := kwargs .pop ("filter" , None )) is not None :
255
269
local_flags .append (f"--filter={ filter } " )
256
270
if depth is not None :
257
- local_flags .extend (["--depth" , depth ])
271
+ local_flags .extend (["--depth" , str ( depth ) ])
258
272
if branch is not None :
259
273
local_flags .extend (["--branch" , branch ])
260
274
if origin is not None :
@@ -308,7 +322,9 @@ def clone(
308
322
if make_parents and not self .dir .exists ():
309
323
self .dir .mkdir (parents = True )
310
324
return self .run (
311
- ["clone" , * local_flags , "--" , * required_flags ], check_returncode = False
325
+ ["clone" , * local_flags , "--" , * required_flags ],
326
+ config = config ,
327
+ check_returncode = False ,
312
328
)
313
329
314
330
def fetch (
0 commit comments