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ยง
- AsString
Array ๐ - Clear
Pid ๐ - Generated ๐
- Handle
Cancel localGit:cancel(operationId)- SIGTERM the pid we stashed foroperationId. Silent no-op if unknown.- Handle
Checkout localGit:checkout(operationId, repoPath, treeish, detached?)- Handle
Clone localGit:clone(operationId, cloneUrl, targetPath, ref?)- Handle
Exec localGit:exec- accept either{ Arguments, cwd?, operationId? }or a legacy positional(Arguments: string[], cwd?: string). Returns{ stdout, stderr, exitCode }.- Handle
Fetch localGit:fetch(operationId, repoPath)- Handle
IsAvailable localGit:isAvailable- cheapgit --versionprobe, cached for the process lifetime so UI polling doesnโt re-exec git.- Handle
Pull localGit:pull(operationId, repoPath) -> boolean(true = HEAD moved).- Handle
RevList Count localGit:revListCount(repoPath, fromRef, toRef) -> number- Handle
RevParse localGit:revParse(repoPath, ref) -> string- Register
Pid ๐ - Resolve
Cwd ๐ - RunGit ๐
- Running
Processes ๐ - TakePid ๐