Repository navigation
fix: keep failed checkouts accurate and speed up branch switches - #40
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66fc823b16
ℹ️ 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".
| // Keep HEAD sourced from Git: a rejected checkout must not change the | ||
| // displayed branch. Successful completion triggers the normal model refresh. |
There was a problem hiding this comment.
Refresh HEAD when checkout reports a post-hook error
When a repository has a post-checkout hook that exits nonzero, Git has already switched branches but propagates the hook's exit status; the official documentation confirms that the hook cannot affect the checkout outcome and only changes the command's exit status (Git githooks documentation). Here the closure consequently returns Err, while receive_remote_op_results does not request a refresh on errors; after removing the optimistic updates, the model therefore continues showing the old branch and hash even though the real HEAD moved. Refresh the model—or explicitly re-read HEAD—after a checkout error before deciding which branch to display.
Useful? React with 👍 / 👎.
Summary
Measured latency
Headless event-loop benchmark on a local two-branch fixture, 10 successful switches per mode; measures request to both displayed branch marker and HEAD identity updating (not total full-panel refresh or terminal rendering):
Timing is machine/repository dependent. Git's checkout command and hooks are unchanged; the improvement removes application-side waiting after checkout.
Run the manual benchmark with
cargo test checkout_visibility_latency -- --ignored --nocapture.Regression coverage
-), and ref picker (c).Validation
cargo fmt --checkcargo test— 295 passed, 1 manual benchmark ignoredcargo clippy --all-targets— completed with warningsImplemented in a separate worktree branched from
origin/main; no edits made to the original worktree.