Skip to content

Commit 647aca5

Browse files
committed
feat(git): make_parents
1 parent 497f24d commit 647aca5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libvcs/cmd/git.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ def clone(
206206
no_remote_submodules: Optional[bool] = None,
207207
verbose: Optional[bool] = None,
208208
quiet: Optional[bool] = None,
209+
# Special behavior
210+
make_parents: Optional[bool] = True,
209211
**kwargs,
210212
):
211213
"""Clone a working copy from an git repo.
@@ -220,6 +222,8 @@ def clone(
220222
Separate repository (.git/ ) from working tree
221223
force : bool, optional
222224
force operation to run
225+
make_parents : bool, default: ``True``
226+
Creates checkout directory (`:attr:`self.dir`) if it doesn't already exist.
223227
224228
Examples
225229
--------
@@ -289,6 +293,10 @@ def clone(
289293
local_flags.append("--remote-submodules")
290294
if no_remote_submodules is True:
291295
local_flags.append("--no-remote-submodules")
296+
297+
# libvcs special behavior
298+
if make_parents and not self.dir.exists():
299+
self.dir.mkdir(parents=True)
292300
return self.run(
293301
["clone", *local_flags, "--", *required_flags], check_returncode=False
294302
)

0 commit comments

Comments
 (0)