Skip to content

Commit b37dade

Browse files
committed
!squash projects.git.obtain: Start moving over, needs logging in real time
1 parent 92d98bd commit b37dade

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

libvcs/projects/git.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from typing import Dict, Literal, Optional, TypedDict, Union
2323
from urllib import parse as urlparse
2424

25+
from libvcs.cmd.git import Git
2526
from libvcs.types import StrPath
2627

2728
from .. import exc
@@ -313,24 +314,26 @@ def set_remotes(self, overwrite: bool = False):
313314

314315
def obtain(self, *args, **kwargs):
315316
"""Retrieve the repository, clone if doesn't exist."""
316-
self.ensure_dir()
317-
318-
url = self.url
317+
clone_kwargs = {}
319318

320-
cmd = ["clone", "--progress"]
321319
if self.git_shallow:
322-
cmd.extend(["--depth", "1"])
320+
clone_kwargs["depth"] = 1
323321
if self.tls_verify:
324-
cmd.extend(["-c", "http.sslVerify=false"])
325-
cmd.extend([url, self.dir])
322+
clone_kwargs["c"] = "http.sslVerify=false"
326323

327324
self.log.info("Cloning.")
328-
self.run(cmd, log_in_real_time=True)
325+
326+
git = Git(dir=self.dir)
327+
328+
# Needs to log to std out, e.g. log_in_real_time
329+
git.clone(url=self.url, progress=True, make_parents=True, **clone_kwargs)
329330

330331
self.log.info("Initializing submodules.")
332+
331333
self.run(["submodule", "init"], log_in_real_time=True)
332-
cmd = ["submodule", "update", "--recursive", "--init"]
333-
self.run(cmd, log_in_real_time=True)
334+
self.run(
335+
["submodule", "update", "--recursive", "--init"], log_in_real_time=True
336+
)
334337

335338
self.set_remotes(overwrite=True)
336339

0 commit comments

Comments
 (0)