MCPcopy Create free account
hub / github.com/GCWing/BitFun / git_reset_files

Function git_reset_files

src/apps/desktop/src/api/git_api.rs:1033–1063  ·  view source on GitHub ↗
(
    state: State<'_, AppState>,
    request: GitResetFilesRequest,
)

Source from the content-addressed store, hash-verified

1031
1032#[tauri::command]
1033pub async fn git_reset_files(
1034 state: State<'_, AppState>,
1035 request: GitResetFilesRequest,
1036) -> Result<GitOperationResult, String> {
1037 let staged = request.staged.unwrap_or(false);
1038
1039 info!(
1040 "Resetting files in '{}' (staged: {}): {:?}",
1041 request.repository_path, staged, request.files
1042 );
1043
1044 if let Some(target) = resolve_remote_git_target(&request.repository_path).await {
1045 let mut args = vec!["restore".to_string()];
1046 if staged {
1047 args.push("--staged".to_string());
1048 }
1049 args.extend(request.files);
1050 return execute_remote_git_operation(&state, &target, &args).await;
1051 }
1052
1053 GitService::reset_files(&request.repository_path, &request.files, staged)
1054 .await
1055 .map(|output| GitOperationResult {
1056 success: true,
1057 data: None,
1058 error: None,
1059 output: Some(output),
1060 duration: None,
1061 })
1062 .map_err(|e| e.to_string())
1063}
1064
1065#[tauri::command]
1066pub async fn git_get_file_content(

Callers

nothing calls this directly

Calls 3

pushMethod · 0.45

Tested by

no test coverage detected