Skip to main content

Mountain/IPC/WindServiceHandlers/Git/
HandleFetch.rs

1
2//! `localGit:fetch(operationId, repoPath)`. Plain `git fetch`
3//! against the configured upstream - no remote argument, no
4//! `--all`, mirroring stock VS Code's `LocalGitService.fetch`.
5
6use serde_json::Value;
7
8use crate::IPC::WindServiceHandlers::Git::Shared::RunGit::Fn as RunGit;
9
10pub async fn Fn(Arguments:Vec<Value>) -> Result<Value, String> {
11	let OperationId = Arguments.first().and_then(Value::as_str).unwrap_or("").to_string();
12
13	let RepoPath = Arguments.get(1).and_then(Value::as_str).unwrap_or("").to_string();
14
15	if RepoPath.is_empty() {
16		return Err("git:fetch requires repoPath".to_string());
17	}
18
19	let (ExitCode, _, Stderr) = RunGit(&OperationId, &["fetch".to_string()], Some(&RepoPath)).await?;
20
21	if ExitCode != 0 {
22		return Err(format!("git fetch failed: {}", Stderr));
23	}
24
25	Ok(Value::Null)
26}