|
47 | 47 |
|
48 | 48 | retry_on_clone_error = retry( |
49 | 49 | retry=retry_if_exception_type(RETRYABLE_CLONE_ERRORS), |
50 | | - stop=stop_after_attempt(6), |
| 50 | + stop=stop_after_attempt(3), |
51 | 51 | wait=wait_exponential(multiplier=5, min=5, max=120), |
52 | 52 | reraise=True, |
53 | 53 | ) |
@@ -190,9 +190,14 @@ async def _perform_minimal_clone(self, path: str, remote: str) -> None: |
190 | 190 | Perform minimal clone of depth=1 |
191 | 191 | """ |
192 | 192 | self.logger.info("Initializing minimal clone") |
193 | | - await run_shell_command( |
194 | | - ["git", "clone", "--depth=1", "--no-tags", "--single-branch", remote, "."], cwd=path |
195 | | - ) |
| 193 | + base_cmd = ["git", "clone", "--depth=1", "--no-tags", "--single-branch"] |
| 194 | + try: |
| 195 | + await run_shell_command([*base_cmd, f"{remote}.git", "."], cwd=path) |
| 196 | + except Exception: |
| 197 | + self.logger.warning( |
| 198 | + f"Clone with .git suffix failed, falling back to bare URL: {remote}" |
| 199 | + ) |
| 200 | + await run_shell_command([*base_cmd, remote, "."], cwd=path) |
196 | 201 | self.logger.info("Minimal clone initialized successfully") |
197 | 202 |
|
198 | 203 | async def _get_repo_size_mb(self, repo_path: str) -> float: |
@@ -377,9 +382,14 @@ async def _cleanup_working_directory(self, repo_path: str) -> None: |
377 | 382 | async def _perform_full_clone(self, repo_path: str, remote: str): |
378 | 383 | """Perform full repository clone""" |
379 | 384 | self.logger.info(f"Performing full clone for repo {remote}...") |
380 | | - await run_shell_command( |
381 | | - ["git", "clone", "--no-tags", "--single-branch", remote, "."], cwd=repo_path |
382 | | - ) |
| 385 | + base_cmd = ["git", "clone", "--no-tags", "--single-branch"] |
| 386 | + try: |
| 387 | + await run_shell_command([*base_cmd, f"{remote}.git", "."], cwd=repo_path) |
| 388 | + except Exception: |
| 389 | + self.logger.warning( |
| 390 | + f"Clone with .git suffix failed, falling back to bare URL: {remote}" |
| 391 | + ) |
| 392 | + await run_shell_command([*base_cmd, remote, "."], cwd=repo_path) |
383 | 393 | self.logger.info(f"Successfully completed full clone of repository: {remote}") |
384 | 394 |
|
385 | 395 | async def has_default_branch_changed(self, remote: str, saved_branch: str | None) -> bool: |
|
0 commit comments