fix(jj): show closest bookmark instead of 'detached' in UI#144
Merged
agavra merged 1 commit intoagavra:mainfrom Jan 24, 2026
Merged
fix(jj): show closest bookmark instead of 'detached' in UI#144agavra merged 1 commit intoagavra:mainfrom
agavra merged 1 commit intoagavra:mainfrom
Conversation
Problem: When running tuicr in jj-mode, the header always showed [jj:detached] even when working on commits that descend from bookmarked commits. This is because the code only checked for bookmarks directly on @. Solution: Use a two-step bookmark discovery approach: 1. First check if @ has a bookmark directly 2. Fall back to 'heads(::@ & bookmarks())' to find the closest ancestor bookmark (the one you're most likely working towards) 3. Extract the first local bookmark name, filtering out remote tracking refs like 'main@upstream' Test coverage: - test_jj_bookmark_on_current_revision: bookmark directly on @ - test_jj_bookmark_on_ancestor_revision: bookmark on ancestor (common case) - test_jj_no_bookmarks: graceful fallback when no bookmarks exist
Collaborator
Author
|
A clarification regarding range selects and implications on jj bookmarks. The git VCS integration uses the current checkout (HEAD) for working tree diffs and does not attempt to find a branch for arbitrary commit ranges—it simply shows "detached" if not on a branch. This matches the default behavior in most git UIs. Therefore, for jj, showing the closest bookmark to the selected revision or commit range, is consistent. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
When running tuicr in jj-mode, the header always showed [jj:detached] even when working on commits that descend from bookmarked commits. This is because the code only checked for bookmarks directly on @.
Solution:
Use a two-step bookmark discovery approach:
Test coverage: