Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/Git/
HandleFetch.rs

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