Implement interactive hunk staging and discarding

Introduce a new dialog that allows users to view file changes as individual hunks and selectively stage, unstage, or discard them. This provides more granular control over modifications, similar to `git add -p`.

Enhance branch panel usability by allowing double-click to checkout a branch.
This commit is contained in:
Christoph Brandau
2026-07-01 14:47:36 +02:00
parent 0bbd5ce1e8
commit 5752243e6e
9 changed files with 636 additions and 11 deletions
+14
View File
@@ -8,6 +8,7 @@ import type {
GitRepositoryFile,
GitSearchHit,
GitStatus,
PatchApplyAction,
RepositoryBundle,
StoredCredential,
} from "./types";
@@ -56,6 +57,19 @@ export function restoreFiles(
return invoke<GitStatus>("restore_files", { path, files, staged });
}
export function getFilePatch(path: string, file: string, staged: boolean): Promise<string> {
return invoke<string>("get_file_patch", { path, file, staged });
}
export function applyFilePatch(
path: string,
file: string,
patch: string,
action: PatchApplyAction,
): Promise<GitStatus> {
return invoke<GitStatus>("apply_file_patch", { path, file, patch, action });
}
export function commit(path: string, message: string): Promise<GitStatus> {
return invoke<GitStatus>("commit", { path, message });
}