feat(git): Add comprehensive worktree management capabilities
This update introduces full support for Git worktrees, allowing users to manage multiple isolated working copies within a single repository. This includes new functionality to list, add, remove, move, lock, and repair worktrees, significantly enhancing the repository's capability to handle parallel development streams. - Added `GitWorktree` structure definition across API contracts and Rust backend - Implemented full CRUD operations for worktrees in Tauri commands - Updated UI components (App.svelte, BranchPanel.svelte) to expose worktree management dialog
This commit is contained in:
@@ -33,6 +33,24 @@ interface GitBranch {
|
||||
remote: boolean;
|
||||
}
|
||||
|
||||
interface GitWorktree {
|
||||
path: string;
|
||||
head: string | null;
|
||||
short_head: string | null;
|
||||
branch: string | null;
|
||||
bare: boolean;
|
||||
detached: boolean;
|
||||
locked: boolean;
|
||||
lock_reason: string | null;
|
||||
prunable: boolean;
|
||||
prune_reason: string | null;
|
||||
missing: boolean;
|
||||
is_main: boolean;
|
||||
is_current: boolean;
|
||||
clean: boolean;
|
||||
changed_files: number;
|
||||
}
|
||||
|
||||
interface GitCommit {
|
||||
hash: string;
|
||||
short_hash: string;
|
||||
@@ -73,6 +91,14 @@ The command list below includes the repository-management and synchronization AP
|
||||
- `set_branch_upstream(path: string, branch: string, upstream?: string): Promise<GitStatus>`
|
||||
- `delete_remote_branch(path: string, remote: string, branch: string): Promise<GitStatus>`
|
||||
- `checkout_branch(path: string, branch: string): Promise<GitStatus>`
|
||||
- `list_worktrees(path: string): Promise<GitWorktree[]>`
|
||||
- `add_worktree(path: string, worktreePath: string, ...): Promise<GitWorktree[]>`
|
||||
- `remove_worktree(path: string, worktreePath: string, force?: boolean): Promise<GitWorktree[]>`
|
||||
- `move_worktree(path: string, worktreePath: string, destination: string): Promise<GitWorktree[]>`
|
||||
- `lock_worktree(path: string, worktreePath: string, reason?: string): Promise<GitWorktree[]>`
|
||||
- `unlock_worktree(path: string, worktreePath: string): Promise<GitWorktree[]>`
|
||||
- `prune_worktrees(path: string): Promise<GitWorktree[]>`
|
||||
- `repair_worktree(path: string, worktreePath: string): Promise<GitWorktree[]>`
|
||||
- `stage_files(path: string, files: string[]): Promise<GitStatus>`
|
||||
- `unstage_files(path: string, files: string[]): Promise<GitStatus>`
|
||||
- `restore_files(path: string, files: string[], staged: boolean): Promise<GitStatus>`
|
||||
|
||||
Reference in New Issue
Block a user