feat(folder): add commit reset action in git log
Add a "Reset to Here" context action for git log commit items in the folder page. Show a reset dialog with branch, target commit, commit message, and reset mode details for soft, mixed, hard, and keep. Disable reset when viewing a non-current branch filter and keep the action ordering under commit diff. Add git_reset support across Rust commands, Tauri invoke registration, web handlers/routes, and frontend API/type bindings. Add localized reset labels, mode descriptions, and toast messages across all supported languages.
This commit is contained in:
@@ -252,6 +252,21 @@ pub async fn git_checkout(
|
||||
Ok(Json(()))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GitResetParams {
|
||||
pub path: String,
|
||||
pub commit: String,
|
||||
pub mode: String,
|
||||
}
|
||||
|
||||
pub async fn git_reset(
|
||||
Json(params): Json<GitResetParams>,
|
||||
) -> Result<Json<()>, AppCommandError> {
|
||||
folder_commands::git_reset(params.path, params.commit, params.mode).await?;
|
||||
Ok(Json(()))
|
||||
}
|
||||
|
||||
pub async fn git_list_branches(
|
||||
Json(params): Json<PathParams>,
|
||||
) -> Result<Json<Vec<String>>, AppCommandError> {
|
||||
|
||||
@@ -181,6 +181,7 @@ pub fn build_router(state: Arc<AppState>, token: String, static_dir: std::path::
|
||||
)
|
||||
.route("/git_new_branch", post(handlers::git::git_new_branch))
|
||||
.route("/git_checkout", post(handlers::git::git_checkout))
|
||||
.route("/git_reset", post(handlers::git::git_reset))
|
||||
.route("/git_delete_branch", post(handlers::git::git_delete_branch))
|
||||
.route("/git_merge", post(handlers::git::git_merge))
|
||||
.route("/git_rebase", post(handlers::git::git_rebase))
|
||||
|
||||
Reference in New Issue
Block a user