Skip to content

Commit 948f46b

Browse files
committed
feat: lean clone the application to pick current repo history only
1 parent db3ea9a commit 948f46b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cli/app/commands/clone/clone.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def clone_repository(self, repo: str, path: str, branch: str = None) -> tuple[bo
4949
class GitCommandBuilder:
5050
@staticmethod
5151
def build_clone_command(repo: str, path: str, branch: str = None) -> list[str]:
52-
cmd = ["git", "clone"]
52+
cmd = ["git", "clone", "--depth=1"]
5353
if branch:
5454
cmd.extend(["-b", branch])
5555
cmd.extend([repo, path])
@@ -103,8 +103,8 @@ def __init__(self, logger: LoggerProtocol):
103103

104104
def clone_repository(self, repo: str, path: str, branch: str = None) -> tuple[bool, str]:
105105
cmd = GitCommandBuilder.build_clone_command(repo, path, branch)
106-
107-
self.logger.debug(debug_executing_git_clone.format(command=' '.join(cmd)))
106+
107+
self.logger.debug(debug_executing_git_clone.format(command=" ".join(cmd)))
108108

109109
try:
110110
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
@@ -216,8 +216,9 @@ def _create_result(self, success: bool, error: str = None) -> CloneResult:
216216

217217
def clone(self) -> CloneResult:
218218
import time
219+
219220
start_time = time.time()
220-
221+
221222
self.logger.debug(debug_cloning_repo.format(repo=self.config.repo, path=self.config.path, force=self.config.force))
222223

223224
if not self._validate_prerequisites():
@@ -227,7 +228,7 @@ def clone(self) -> CloneResult:
227228
return self._create_result(False, failed_to_prepare_target_directory)
228229

229230
success, error = self.cloner.clone_repository(self.config.repo, self.config.path, self.config.branch)
230-
231+
231232
duration = time.time() - start_time
232233
self.logger.debug(debug_clone_completed.format(duration=f"{duration:.2f}", success=success))
233234

0 commit comments

Comments
 (0)