( session: ExecutionSession, workspacePath: string, branchName: string, options: RestoreWorkspaceOptions )
| 821 | // credential helper. The sandbox gitCheckout API only posts the URL and |
| 822 | // does not document session-env inheritance. |
| 823 | const cloneArgs = ['git', 'clone', '--progress']; |
| 824 | if (shallow) { |
| 825 | cloneArgs.push('--depth', '1'); |
| 826 | } |
| 827 | cloneArgs.push(cloneUrl, workspacePath); |
| 828 | const result = await timedExec(session, cloneArgs.map(shellQuote).join(' '), 'git.clone', { |
| 829 | timeoutMs: GIT_CLONE_TIMEOUT_MS, |
| 830 | }); |
| 831 | |
| 832 | if (result.exitCode !== 0) { |
| 833 | throw new Error( |
| 834 | `git clone failed with exit code ${result.exitCode ?? 'unknown'}: ${result.stderr || result.stdout}` |
| 835 | ); |
| 836 | } |
| 837 | |
| 838 | await updateGitAuthor( |
| 839 | session, |
| 840 | workspacePath, |
| 841 | gitAuthor ?? { name: 'Kilo Code Cloud', email: 'agent@kilocode.ai' } |
| 842 | ); |
| 843 | |
| 844 | logger.info('Successfully cloned generic git repository'); |
| 845 | } catch (err) { |
| 846 | const errorMessage = err instanceof Error ? err.message : String(err); |
| 847 | logger.error('Git clone failed', { |
| 848 | error: sanitizeGitOutput(errorMessage), |
| 849 | gitUrl: sanitizedGitUrl, |
| 850 | }); |
nothing calls this directly
no test coverage detected