Compare commits

..

6 Commits

Author SHA1 Message Date
Aleksei Sviridkin
1dd6eb4219 Merge 2d4c952b4b into a272bf7e41 2025-03-08 23:37:09 +11:00
dw-0
a272bf7e41 feat(moonraker): display moonraker ip address after install
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2025-03-08 11:40:22 +01:00
CODeRUS
41d3d749b0 fix: Add pkg-config to klipper packages (#655)
Signed-off-by: Andrey Kozhevnikov <coderusinbox@gmail.com>
2025-03-06 18:33:55 +01:00
Aleksei Sviridkin
2d4c952b4b feat(git_utils): enhance git_cmd_clone with optional depth and single-branch parameters
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2025-02-21 07:36:49 +03:00
Aleksei Sviridkin
d5119bc264 fix(git_utils): add a newline for better readability in git_cmd_clone
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2025-02-20 02:56:17 +03:00
Aleksei Sviridkin
8cb66071ac feat(git_utils): enhance git_cmd_clone with depth and single-branch options
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2025-02-20 02:52:23 +03:00

View File

@@ -253,9 +253,29 @@ def get_remote_commit(repo: Path) -> str | None:
return None
def git_cmd_clone(repo: str, target_dir: Path) -> None:
def git_cmd_clone(repo: str, target_dir: Path, depth: int = 0, single_branch: bool = False) -> None:
"""
Clones a repository with optional depth and single-branch parameters.
: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
"""
try:
command = ["git", "clone", repo, target_dir.as_posix()]
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")
command += [repo, target_dir.as_posix()]
run(command, check=True)
Logger.print_ok("Clone successful!")