Skip to main content

Module Git

Module Git 

Source
Expand description

Git subprocess handlers exposed to the renderer via the localGit channel. Mirrors stock VS Codeโ€™s ILocalGitService API (src/vs/platform/git/common/localGitService.ts) - clone, pull, checkout, revParse, fetch, revListCount, cancel. Adds two Land-specific auxiliaries: exec (arbitrary argv, used by the Git extension) and isAvailable (synchronous feature detection).

Cancellation is keyed on OperationId; the shared RunningProcesses map survives across invokes so the renderer can fire cancel from a different Tauri invoke. tokio::process::Child doesnโ€™t expose a stable Send handle across threads, so we store the PID instead and send SIGTERM on cancel (Unix) / TerminateProcess via taskkill on Windows.

Functionsยง

AsStringArray ๐Ÿ”’
ClearPid ๐Ÿ”’
Generated ๐Ÿ”’
HandleCancel
localGit:cancel(operationId) - SIGTERM the pid we stashed for operationId. Silent no-op if unknown.
HandleCheckout
localGit:checkout(operationId, repoPath, treeish, detached?)
HandleClone
localGit:clone(operationId, cloneUrl, targetPath, ref?)
HandleExec
localGit:exec - accept either { Arguments, cwd?, operationId? } or a legacy positional (Arguments: string[], cwd?: string). Returns { stdout, stderr, exitCode }.
HandleFetch
localGit:fetch(operationId, repoPath)
HandleIsAvailable
localGit:isAvailable - cheap git --version probe, cached for the process lifetime so UI polling doesnโ€™t re-exec git.
HandlePull
localGit:pull(operationId, repoPath) -> boolean (true = HEAD moved).
HandleRevListCount
localGit:revListCount(repoPath, fromRef, toRef) -> number
HandleRevParse
localGit:revParse(repoPath, ref) -> string
RegisterPid ๐Ÿ”’
ResolveCwd ๐Ÿ”’
RunGit ๐Ÿ”’
RunningProcesses ๐Ÿ”’
TakePid ๐Ÿ”’