refactor: simplify FetchBadge component and improve animation handling#51
Conversation
- Added stash management commands in Tauri: list, quick stat, show, push, pop, apply, drop, clear, and branch. - Created models for stash entries, quick stats, and detailed stash responses. - Implemented parsing logic for stash output from Git commands. - Introduced a new utility function for formatting numbers. - Added a new icon for stashed items in the icon package. - Updated the icon index to export the new Stashed icon.
…n configuration files
…tatus bar styling
- Updated `DiffState` to support fetching diffs from stashed references. - Introduced `restoreFile` method in `StashState` for restoring individual files from stash. - Enhanced `useAppStore` to manage Git view states, including stash references and filters. - Modified `get_patch_by_file_path` in `DiffService` to handle stash references. - Implemented `stashRestoreFile` command for restoring files from stash. - Added validation for stash references in `stash.rs`. - Updated UI components for improved alert dialog and resizable handle interactions.
|
@codex[agent] could you pls review this PR? |
|
@codex[agent] review this PR |
|
@claude[agent] review this PR |
|
@codex review |
Greptile SummaryThis PR implements comprehensive git stash management functionality across the entire stack - from Rust backend services to React frontend UI. The changes include a complete Key additions:
Note: The PR title "refactor: simplify FetchBadge component and improve animation handling" doesn't accurately reflect the scope - this is a major feature addition (~3,200 lines added, ~700 removed) implementing full stash management, not just a simple refactor. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as React UI
participant Hook as useStash Hook
participant State as StashState
participant Cmd as Tauri Command
participant Svc as StashService (Rust)
participant Git as Git CLI
participant Cache as Cache Layer
Note over UI,Cache: Stash List Query Flow
UI->>Hook: useStashList()
Hook->>State: stash.list()
State->>Cache: Check cache
alt Cache Hit
Cache-->>State: Return cached data
else Cache Miss
State->>Cmd: stashList()
Cmd->>Svc: service.stash().list()
Svc->>Git: git stash list --format=%gd%x1f%gs
Git-->>Svc: Raw output
Svc->>Svc: parse_stash_list()
Svc-->>Cache: Store in cache
Svc-->>Cmd: Vec<StashEntry>
Cmd-->>State: Result
end
State-->>Hook: StashEntry[]
Hook-->>UI: Display stash list
Note over UI,Cache: Stash Pop Mutation Flow
UI->>Hook: useStashPop().mutate()
Hook->>State: stash.pop(reference)
State->>Cmd: stashPop({reference})
Cmd->>Svc: service.stash().pop(reference)
Svc->>Svc: Acquire repo lock
Svc->>Git: git stash pop --quiet stash@{N}
Git-->>Svc: Success/Conflict/Error
alt Success
Svc->>Cache: invalidate_all()
Svc-->>Cmd: "Popped stash@{N}"
else Conflict
Svc-->>Cmd: Error with conflict details
end
Cmd-->>State: Result
State-->>Hook: Result
Hook->>Hook: onSuccess: invalidate queries
Hook-->>UI: Toast notification
Last reviewed commit: 20b6e50 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20b6e5060b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .ctx | ||
| .runner | ||
| .run_with_options(&["stash", "pop"], GitRunOptions::default_read()); | ||
| let _ = self.stash().pop(None).await; |
There was a problem hiding this comment.
Avoid popping top stash when rollback has no new stash
This rollback path unconditionally calls pop(None), which resolves to stash@{0} and can remove/apply an unrelated stash if stash push created no entry (Git returns success with "No local changes to save") or if another stash is at the top. In a failed branch switch/create (for example, target branch creation/switch fails after the stash step), this can unexpectedly mutate the working tree and drop the user's existing stash instead of rolling back only the stash created for this operation.
Useful? React with 👍 / 👎.
| .find(|(start, end)| { | ||
| lines[*start..*end] | ||
| .iter() | ||
| .any(|line| path_markers.iter().any(|marker| line.contains(marker))) |
There was a problem hiding this comment.
Match stash diff section by exact file path
Using line.contains(marker) to select a stash diff section can pick the wrong file when one path is a prefix of another (for example src/a.ts vs src/a.tsx), because both headers contain a/src/a.ts. In that case the first matching section is returned, so the UI can display a patch for a different file than the one selected.
Useful? React with 👍 / 👎.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryThis PR implements a comprehensive git stash feature with full UI integration across the application. Despite the modest title suggesting only a badge component refactor, this is a major feature addition spanning 44 files with 3,400+ insertions and 880 deletions. Key Changes:
Architecture: Quality: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as React UI
participant Hook as useStash Hook
participant State as StashState
participant Cmd as Tauri Command
participant Svc as StashService
participant Git as Git CLI
participant Cache as Cache Layer
Note over UI,Cache: Stash List Query
UI->>Hook: useStashList()
Hook->>State: stash.list()
State->>Cache: Check cache
alt Cache Hit
Cache-->>State: Return cached data
else Cache Miss
State->>Cmd: stashList()
Cmd->>Svc: service.stash().list()
Svc->>Git: git stash list
Git-->>Svc: Raw output
Svc->>Svc: parse_stash_list()
Svc-->>Cache: Store in cache
Svc-->>Cmd: Vec[StashEntry]
Cmd-->>State: Result
end
State-->>Hook: StashEntry[]
Hook-->>UI: Display stash list
Note over UI,Cache: Stash Pop Mutation
UI->>Hook: useStashPop().mutate()
Hook->>State: stash.pop(reference)
State->>Cmd: stashPop(reference)
Cmd->>Svc: service.stash().pop(reference)
Svc->>Svc: Acquire repo lock
Svc->>Git: git stash pop
Git-->>Svc: Success or Error
alt Success
Svc->>Cache: invalidate_all()
Svc-->>Cmd: Success message
else Conflict
Svc-->>Cmd: Error with conflict details
end
Cmd-->>State: Result
State-->>Hook: Result
Hook->>Hook: onSuccess: invalidate queries
Hook-->>UI: Toast notification
Note over UI,Cache: Branch Switch with Stash
UI->>Svc: switchBranch with StashOnCurrentBranch
Svc->>Svc: push_gitru_stash(from, to)
Svc->>Git: git stash push with Gitru marker
Git-->>Svc: Stash created
Svc->>Git: git checkout branch
alt Checkout Success
Git-->>Svc: Success
Svc->>Cache: invalidate_all()
else Checkout Fail
Git-->>Svc: Error
Svc->>Svc: Rollback: pop stash
Svc-->>UI: Error message
end
Last reviewed commit: 823662d |

sequenceDiagram participant UI as React UI participant Hook as useStash Hook participant State as StashState participant Cmd as Tauri Command participant Svc as StashService participant Git as Git CLI participant Cache as Cache Layer Note over UI,Cache: Stash List Query UI->>Hook: useStashList() Hook->>State: stash.list() State->>Cache: Check cache alt Cache Hit Cache-->>State: Return cached data else Cache Miss State->>Cmd: stashList() Cmd->>Svc: service.stash().list() Svc->>Git: git stash list Git-->>Svc: Raw output Svc->>Svc: parse_stash_list() Svc-->>Cache: Store in cache Svc-->>Cmd: Vec[StashEntry] Cmd-->>State: Result end State-->>Hook: StashEntry[] Hook-->>UI: Display stash list Note over UI,Cache: Stash Pop Mutation UI->>Hook: useStashPop().mutate() Hook->>State: stash.pop(reference) State->>Cmd: stashPop(reference) Cmd->>Svc: service.stash().pop(reference) Svc->>Svc: Acquire repo lock Svc->>Git: git stash pop Git-->>Svc: Success or Error alt Success Svc->>Cache: invalidate_all() Svc-->>Cmd: Success message else Conflict Svc-->>Cmd: Error with conflict details end Cmd-->>State: Result State-->>Hook: Result Hook->>Hook: onSuccess: invalidate queries Hook-->>UI: Toast notification Note over UI,Cache: Branch Switch with Stash UI->>Svc: switchBranch with StashOnCurrentBranch Svc->>Svc: push_gitru_stash(from, to) Svc->>Git: git stash push with Gitru marker Git-->>Svc: Stash created Svc->>Git: git checkout branch alt Checkout Success Git-->>Svc: Success Svc->>Cache: invalidate_all() else Checkout Fail Git-->>Svc: Error Svc->>Svc: Rollback: pop stash Svc-->>UI: Error message end