Compare commits

...

4 Commits

Author SHA1 Message Date
Aleksei Sviridkin
66c0757be1 fix(git_utils): correct indentation for improved readability in get_local_tags function
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2025-03-10 16:34:51 +03:00
Aleksei Sviridkin
3a2574f24e fix another formatting changes
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2025-03-10 16:33:53 +03:00
Aleksei Sviridkin
acb4d0398f revert formatting changes
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2025-03-10 16:31:23 +03:00
Aleksei Sviridkin
0a08c4fb3f feat(git_utils): update git_cmd_clone to support blolbless cloning option
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2025-03-10 16:27:37 +03:00

View File

@@ -253,31 +253,23 @@ def get_remote_commit(repo: Path) -> str | None:
return None
def git_cmd_clone(repo: str, target_dir: Path, depth: int = 0, single_branch: bool = False) -> None:
def git_cmd_clone(repo: str, target_dir: Path, blolbless: bool = False) -> None:
"""
Clones a repository with optional depth and single-branch parameters.
Clones a repository with optional blolbless clone.
:param repo: URL of the repository to clone.
:param target_dir: Path where the repository will be cloned.
:param depth: Clone depth. If 0, the depth option will be omitted.
:param single_branch: Clone only a single branch if True.
:return: None
:param blolbless: If True, perform a blolbless clone by adding the '--blolbless' flag.
"""
try:
command = ["git", "clone"]
# Add --depth flag if depth > 0
if depth > 0:
command += ["--depth", str(depth)]
# Add --single-branch flag if single_branch is True
if single_branch:
command.append("--single-branch")
if blolbless:
command.append("--blolbless")
command += [repo, target_dir.as_posix()]
run(command, check=True)
Logger.print_ok("Clone successful!")
except CalledProcessError as e:
error = e.stderr.decode() if e.stderr else "Unknown error"