(
state: State<'_, AppState>,
request: GitGetFileContentRequest,
)
| 1064 | |
| 1065 | #[tauri::command] |
| 1066 | pub async fn git_get_file_content( |
| 1067 | state: State<'_, AppState>, |
| 1068 | request: GitGetFileContentRequest, |
| 1069 | ) -> Result<String, String> { |
| 1070 | info!( |
| 1071 | "Getting file content for '{}' at commit '{:?}' in repo '{}'", |
| 1072 | request.file_path, request.commit, request.repository_path |
| 1073 | ); |
| 1074 | |
| 1075 | if let Some(target) = resolve_remote_git_target(&request.repository_path).await { |
| 1076 | let object_spec = format!( |
| 1077 | "{}:{}", |
| 1078 | request.commit.as_deref().unwrap_or("HEAD"), |
| 1079 | request.file_path |
| 1080 | ); |
| 1081 | return execute_remote_git_success(&state, &target, &["show".to_string(), object_spec]) |
| 1082 | .await; |
| 1083 | } |
| 1084 | |
| 1085 | let content = GitService::get_file_content( |
| 1086 | &request.repository_path, |
| 1087 | &request.file_path, |
| 1088 | request.commit.as_deref(), |
| 1089 | ) |
| 1090 | .await |
| 1091 | .map_err(|e| e.to_string())?; |
| 1092 | |
| 1093 | Ok(content) |
| 1094 | } |
| 1095 | |
| 1096 | #[tauri::command] |
| 1097 | pub async fn git_reset_to_commit( |
nothing calls this directly
no test coverage detected