feat(git): add advanced clone options (shallow, sparse, flags)

Add advanced clone options support across the frontend and backend.
Users can specify a branch, shallow limits, blobless mode, sparse paths,
and custom clone flags when initiating a clone operation. The backend
validates inputs, parses custom flags without invoking a shell, and
configures sparse checkouts after a successful clone. A small parsing
dependency was added and tracked-file parsing was improved to better
handle git ls-files output.

- Introduce CloneRunOptions and validation helpers for clone inputs
- Parse custom flags with a shell-like tokenizer and block managed flags
- Support sparse checkout configuration and shallow clone constraints
This commit is contained in:
2026-08-31 19:43:30 +02:00
parent 4c58b14691
commit 90df347e4a
7 changed files with 455 additions and 15 deletions
+9
View File
@@ -4,6 +4,7 @@ import type {
AiReviewResult,
AiCommitPlan,
CommitAiProvider,
CloneOptions,
ConflictFile,
DetectedExternalTool,
ExternalToolCommand,
@@ -80,6 +81,7 @@ export function cloneRepository(
username?: string,
password?: string,
commitLimit = 100,
options: CloneOptions = { branch: null, blobless: false, customFlags: "", shallowDepth: null, shallowSince: null, sparse: false, sparsePaths: [] },
): Promise<RepositoryBundle> {
return invoke<RepositoryBundle>("clone_repository", {
remoteUrl,
@@ -88,6 +90,13 @@ export function cloneRepository(
username: username ?? null,
password: password ?? null,
commitLimit,
branch: options.branch,
blobless: options.blobless,
customFlags: options.customFlags,
shallowDepth: options.shallowDepth,
shallowSince: options.shallowSince,
sparse: options.sparse,
sparsePaths: options.sparsePaths,
});
}