Repository navigation
fix: show a detached HEAD clearly, offer the way back, and report the real Linux package version - #86
Conversation
The 0.4.1 AppImage showed as 0.1.0 in AppImage managers (#85). AppManager takes the version from `X-AppImage-Version` in the desktop entry, then from the first `<release>` in the AppStream metainfo. The AppImage had no `X-AppImage-Version`, since `bundle-linux.sh` never passed `VERSION` to appimagetool, and the metainfo listed only 0.1.0. The `.deb` ships the same metainfo, so software centres read 0.1.0 from it too. - `bundle-linux.sh` writes `X-AppImage-Version` into both desktop entries in the AppDir, and passes `VERSION` to appimagetool, which embeds the same value rather than guessing one. - The metainfo lists every tagged release, newest first, with its date and release page. - `tests/linux_metadata.rs` fails when the newest metainfo release is not the crate version, when a CHANGELOG.md release is missing or dated differently, or when releases are out of order. A release bump that forgets the metainfo now fails CI, not the shipped package. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Addresses the remaining points of #85. Shortcuts dying after the palette closed was fixed by #84. Double-clicking a commit always detached HEAD there, including the commit the current branch was on. Nothing then said where HEAD was beyond a faint row tint, which the selection also covered, and getting back meant finding the branch in the sidebar. - Double-click now checks out the local branch pointing at the commit, does nothing if that branch is already checked out, and detaches only when no local branch names the commit (`rgitui_git::commit_checkout`, unit tested). "Checkout commit" in the context menu still detaches. - While the main checkout is detached, a banner names the commit, with "Show in Graph" and "Return to <branch>", or "Switch Branch..." when there is no branch to return to. It is not shown for an inspected worktree (the inspection banner covers it) or during a rebase or bisect. - "Git: Switch to Previous Branch" does the same from the palette, like `git switch -`. The branch is read from the HEAD reflog, whose "checkout: moving from X to Y" entries are written by both git and libgit2. Detached hops and branches since deleted are skipped, so stepping from commit to commit still returns to the starting branch. - In the graph, the HEAD badge reads "-> HEAD" or "-> HEAD (detached)", and the HEAD row keeps its marker bar while selected. A detached HEAD is tinted in the warning colour, as in the title and status bars, instead of a blue that read as a selection. - The title and status bars show the short commit id when detached, instead of "detached"; clicking the title pill shows HEAD in the graph. - `head_branch` came from `shorthand()`, which is the literal "HEAD" when detached, so the title bar named a branch called HEAD and Rename Branch offered to rename it. The refresh now reports no branch when detached, matching what worktree rows already did. CHANGELOG entries cover #83, #84 and this change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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: 6bb171818e
ℹ️ 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".
| has_token, | ||
| ) | ||
| .with_multi_commit_selection(tab.graph.read(cx).selected_commit_count() > 1) | ||
| .with_previous_branch(proj.previous_branch().is_some()) |
There was a problem hiding this comment.
Refresh previous-branch availability after repository changes
When this context is initially built with has_previous_branch == false (for example, in a repository with no earlier checkout), detaching HEAD later populates GitProject::previous_branch, but the RepositoryChanged subscription never calls update_command_context. Because this command is unbound and the palette filters against the cached context, “Git: Switch to Previous Branch” remains hidden until an unrelated selection, tab, or settings change rebuilds the context. Update the command context when refreshed repository state is applied.
Useful? React with 👍 / 👎.
| if let Some(head) = self | ||
| .commits | ||
| .iter() | ||
| .find(|commit| commit.refs.contains(&RefLabel::Head)) |
There was a problem hiding this comment.
Reveal HEAD even when it is outside the loaded commit list
If the detached commit is absent from self.commits—for example, an active “My Commits” filter excludes a commit authored by someone else, or an old detached commit falls beyond the refreshed history window—this method silently does nothing, so both new “Show in Graph” entry points fail. Pass the project's HEAD OID to scroll_to_commit (and account for an excluding author filter) rather than trying to discover HEAD only from the currently visible commits.
Useful? React with 👍 / 👎.
…er it is Review findings on #86. - "Git: Switch to Previous Branch" is filtered by a command context the palette caches, and nothing rebuilt that context when a refresh landed. Detaching HEAD in a repository with no earlier checkout set the previous branch, but the command stayed hidden until an unrelated selection, tab or settings change happened to rebuild it. The same staleness applied to the stash, changes and remote predicates. The repository-change handler now rebuilds the context when the event comes from the active tab's project. - "Show in Graph" and the detached title pill looked for HEAD among the commits the graph had loaded and did nothing when it was not there. Two ways that happens: "My Commits" drops HEAD when someone else authored it, and a detached checkout of an old commit sits beyond the loaded pages. The workspace now passes HEAD's oid from the project. When HEAD is not loaded and "My Commits" is on, the filter is lifted, since it may be what hides HEAD. The reveal then keeps loading pages until HEAD arrives. That always terminates, because the history walk includes a detached HEAD explicitly. Other reveals (tags, reflog, worktrees) still load one page, since their commit may be unreachable and paging would run to the end of history. - A pending scroll target now stops waiting once it is found. It was only cleared when every commit had loaded, so on a repository larger than one page, each later refresh pulled the selection back to it. A new reveal also replaces one still waiting. The pending-scroll decision is a pure function with unit tests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Changelog entry for everything since 0.4.1: #78, #79, #80, #82, #83, #84, #86, #87 and the model-picker follow-up pushed to main. The version is bumped across the workspace, and the AppStream metainfo lists 0.5.0, which the Linux metadata test requires before the crate version can move. The AI work (#79, #80, #82) had no changelog entries; it now has them, with each fix checked against the 0.4.1 code so that only bugs that shipped are listed as fixed. The model-picker fixes in #82 are folded into the feature for that reason: the picker did not exist in 0.4.1. The drafts already under [Unreleased] are checked against the code and corrected where they were off: binary, symlink, submodule and modify/delete conflicts are the whole-file cases (add/add is resolved per region), Stage All skips conflicted files rather than refusing, double-clicking the commit the current branch is on shows a toast, and the diff viewer grows until the graph is down to 120px. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Fixes every point in #85 (Manjaro, KDE Wayland, 0.4.1 AppImage):
X-AppImage-Versionin the desktop entry, and the metainfo only listed 0.1.0mainby #84; this PR extends the same hand-backCloses #85.
Changes
Packaging (
cec4542)script/bundle-linux.shwritesX-AppImage-Versioninto the AppDir's desktop entries and passesVERSIONto appimagetool. AppManager reads this key before anything else (installer.vala).com.rgitui.app.metainfo.xmllists every tagged release, newest first. This is also where the.deband software centres get the version.crates/rgitui/tests/linux_metadata.rsfails if the newest metainfo release isn't the crate version, aCHANGELOG.mdrelease is missing or dated differently, or releases are out of order.Detached HEAD (
6bb1718)rgitui_git::commit_checkout, unit tested). Tags and remote-only branches still detach. The context menu's "Checkout commit" is unchanged.git switch -.checkout: moving from X to Yentries, which git and libgit2 both write.→ HEAD/→ HEAD (detached).head_branchwasshorthand(), which returns the literal"HEAD"when detached. The title bar showed a branch called HEAD and Rename Branch offered to rename it. The refresh now reports no branch when detached, as worktree rows already did.[Unreleased]entries for feat(ui): let the commit graph be hidden so the diff can fill the column #83, fix: hand focus back when overlays close, and raise the Windows stack #84 and this PR. Keymap docs regenerated withRGITUI_BLESS=1.Testing
cargo test --workspace: 1754 passed, 0 failed; 17 new)cargo clippy --workspace --all-targets -- -D warnings, and with--features rgitui/perf)cargo fmt --all -- --check)New tests:
previous_branch: detaching, hopping between detached commits, switching between branches, a deleted branch, never switched, and a detached refresh reporting nohead_branch.commit_checkout: no local branch, a local branch, the checked-out branch preferred.head_display_name, and the three metainfo checks.Not run in the app: the desktop was in use, so the banner, badge styling and double-click behaviour haven't been exercised in a running window. The AppImage path is covered by the script change and the metadata test, not by building an AppImage.
Review fixes
Codex review, round 1 (
c8a258a): two P2 findings, both valid and fixed.cargo test --workspace: 1757 passed, 0 failed. Clippy-D warningsand fmt check are clean.🤖 Generated with Claude Code