Skip to content

Commit 71184e6

Browse files
committed
!squash projects.git.obtain: Start moving over, needs logging in real time
1 parent b7b96e0 commit 71184e6

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

libvcs/projects/git.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
from typing import Dict, Optional, TypedDict, Union
2222
from urllib import parse as urlparse
2323

24+
from libvcs.cmd.git import Git
25+
2426
from .. import exc
2527
from .base import BaseProject, VCSLocation, convert_pip_url as base_convert_pip_url
2628

@@ -300,24 +302,26 @@ def set_remotes(self, overwrite: bool = False):
300302

301303
def obtain(self, *args, **kwargs):
302304
"""Retrieve the repository, clone if doesn't exist."""
303-
self.ensure_dir()
304-
305-
url = self.url
305+
clone_kwargs = {}
306306

307-
cmd = ["clone", "--progress"]
308307
if self.git_shallow:
309-
cmd.extend(["--depth", "1"])
308+
clone_kwargs["depth"] = 1
310309
if self.tls_verify:
311-
cmd.extend(["-c", "http.sslVerify=false"])
312-
cmd.extend([url, self.dir])
310+
clone_kwargs["c"] = "http.sslVerify=false"
313311

314312
self.log.info("Cloning.")
315-
self.run(cmd, log_in_real_time=True)
313+
314+
git = Git(dir=self.dir)
315+
316+
# Needs to log to std out, e.g. log_in_real_time
317+
git.clone(url=self.url, progress=True, make_parents=True, **clone_kwargs)
316318

317319
self.log.info("Initializing submodules.")
320+
318321
self.run(["submodule", "init"], log_in_real_time=True)
319-
cmd = ["submodule", "update", "--recursive", "--init"]
320-
self.run(cmd, log_in_real_time=True)
322+
self.run(
323+
["submodule", "update", "--recursive", "--init"], log_in_real_time=True
324+
)
321325

322326
self.set_remotes(overwrite=True)
323327

0 commit comments

Comments
 (0)