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:
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user