Repository navigation
fix(git-review): key the render's PR cache by the branch's own name - #791
Merged
sirmalloc merged 1 commit intoNov 5, 2026
Merged
Conversation
With a tag named like the current branch, `git symbolic-ref --short HEAD` prints "heads/<branch>". The refresh child keys the PR cache by the full ref with "refs/heads/" stripped since sirmalloc#774, but the render's lookup through the cached runGit (sirmalloc#639) still used --short. The two then hash to different cache files: the child writes the PR to one, Git PR and Git CI Status read the other, and the widgets show "(no PR)" on every render while a refresh runs again each time its lock goes stale. The child also never releases the lock it was handed, since that lock belongs to the other cache file. The render's lookup now reads `symbolic-ref HEAD` and strips the prefix the same way, which is also the command Git Branch already runs, so the cached runGit answers both.
This was referenced Nov 7, 2026
Closed
Closed
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.
#774 made
getCurrentBranchreadsymbolic-ref HEADand striprefs/heads/, becausesymbolic-ref --short HEADprintsheads/<branch>when a tag has the same name as the branch. The render path's own lookup from #639,getCacheRefFromContext, still runssymbolic-ref --short HEADthrough the cachedrunGit.So with a tag named like the branch, the render reads the cache file for
branch:heads/feature/xwhile the refresh child writes the one forbranch:feature/x. The widget never finds the data, and the child never releases the lock it was given (its expected lock path is the other file), so after the lock goes stale anothergh/glabrefresh runs and writes the same unread file again.Real CLI, branch
feature/xwith tagfeature/x, fakeghreturning PR #42, three renders 2s apart:(no PR),(no PR),(no PR), plus an orphaned.lock(no PR)(cold cache), thenPR #42 OPEN Add xtwice; one cache file, no leftover lockgetCacheRefFromContextnow runssymbolic-ref HEADand strips the prefix with the same helpergetCurrentBranchuses (toBranchName). Git Branch already runs that command, so the cachedrunGitanswers both.Added a test where a tag shadows the branch; it fails on main (render and refresh child use different lock paths) and passes with this change. Two existing
runGitstubs were updated for the new command string.