Browse Source

Merge pull request #1027 from jelmer/clone-load-config

Ensure the configuration is loaded in dulwich.porcelain.clone
Jelmer Vernooij 2 years ago
parent
commit
155d507dbc
1 changed files with 7 additions and 1 deletions
  1. 7 1
      dulwich/porcelain.py

+ 7 - 1
dulwich/porcelain.py

@@ -407,6 +407,7 @@ def clone(
     origin="origin",
     depth=None,
     branch=None,
+    config=None,
     **kwargs
 ):
     """Clone a local or remote git repository.
@@ -422,6 +423,7 @@ def clone(
       depth: Depth to fetch at
       branch: Optional branch or tag to be used as HEAD in the new repository
         instead of the cloned repository's HEAD.
+      config: Configuration to use
     Returns: The new repository
     """
     if outstream is not None:
@@ -434,6 +436,9 @@ def clone(
         )
         # TODO(jelmer): Capture logging output and stream to errstream
 
+    if config is None:
+        config = StackedConfig.default()
+
     if checkout is None:
         checkout = not bare
     if checkout and bare:
@@ -444,7 +449,8 @@ def clone(
 
     mkdir = not os.path.exists(target)
 
-    (client, path) = get_transport_and_path(source, **kwargs)
+    (client, path) = get_transport_and_path(
+        source, config=config, **kwargs)
 
     return client.clone(
         path,