(
state: State<'_, AppState>,
request: GitResetToCommitRequest,
)
| 1095 | |
| 1096 | #[tauri::command] |
| 1097 | pub async fn git_reset_to_commit( |
| 1098 | state: State<'_, AppState>, |
| 1099 | request: GitResetToCommitRequest, |
| 1100 | ) -> Result<GitOperationResult, String> { |
| 1101 | info!( |
| 1102 | "Resetting to commit '{}' with mode '{}' in repo '{}'", |
| 1103 | request.commit_hash, request.mode, request.repository_path |
| 1104 | ); |
| 1105 | |
| 1106 | if let Some(target) = resolve_remote_git_target(&request.repository_path).await { |
| 1107 | let mode_flag = match request.mode.as_str() { |
| 1108 | "soft" => "--soft", |
| 1109 | "mixed" => "--mixed", |
| 1110 | "hard" => "--hard", |
| 1111 | _ => return Err(format!("Invalid reset mode: {}", request.mode)), |
| 1112 | }; |
| 1113 | return execute_remote_git_operation( |
| 1114 | &state, |
| 1115 | &target, |
| 1116 | &[ |
| 1117 | "reset".to_string(), |
| 1118 | mode_flag.to_string(), |
| 1119 | request.commit_hash, |
| 1120 | ], |
| 1121 | ) |
| 1122 | .await; |
| 1123 | } |
| 1124 | |
| 1125 | GitService::reset_to_commit( |
| 1126 | &request.repository_path, |
| 1127 | &request.commit_hash, |
| 1128 | &request.mode, |
| 1129 | ) |
| 1130 | .await |
| 1131 | .map_err(|e| { |
| 1132 | error!( |
| 1133 | "Failed to reset to commit: path={}, commit={}, mode={}, error={}", |
| 1134 | request.repository_path, request.commit_hash, request.mode, e |
| 1135 | ); |
| 1136 | format!("Failed to reset: {}", e) |
| 1137 | }) |
| 1138 | } |
| 1139 | |
| 1140 | #[tauri::command] |
| 1141 | pub async fn git_get_graph( |
nothing calls this directly
no test coverage detected