Repository navigation
Conversation
Resetting main onto origin/main, creating a branch on an existing commit, checking out a previous branch or resetting main onto another branch's commit left the Git Tree with stale labels, lanes and colors until a restart. - loadLog: the canonical fast paths (keep the held log, restore LOG_CACHE) compared only the top commit hash. They now compare the fresh first page by hash and decoration; on any difference the fresh entries win, the repo's cache is dropped and re-prefetched. A user scrolled deeper gets a refetch down to the viewed depth, as a forced reload does. Idle polls keep the held array and spawn nothing extra. - Pagination race: replacing the log now invalidates in-flight loadMoreLog pages (fetched at the old --skip offset) so no gap is appended and cached. - CommitGraph: the layout fingerprint includes a one-pass decoration signature, and the trunk pin is re-detected when a ref moves among the pinned rows, not only when the top commit changes. Infinite-scroll appends still keep the pin. Logic extracted to utils/graphLayoutPin.ts. - App.vue: the head/refs watcher and the reset-to-origin path reload the branch list the graph labels from.
- loadLog: only the latest request applies its result, so an older poll result landing after a newer one can't reinstate stale decorations. A superseded forced reload hands its force to the request that applies; the deep refetch respects both. - When loadLog takes changed rows, it reloads the branch list itself if it was already loaded (lazy list untouched). The poller path now refreshes the labels CommitGraph resolves against props.branches; App.vue's explicit calls are gone. - head/refs watcher: forced reload via repoRefresh(true), since decorations may have moved below the first page; the redundant second loadLog is gone. - refsSignature: 32-bit FNV-1a plus decorated-row count instead of concatenating every decorated row (prefix signature hashed too). - Dead TrunkPin.secondaryHashes and redundant length checks removed.
…ranch list ignores a stale repo
This branch has not been deployed
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.
Fixes #266.
Why
The Git Tree kept stale branch labels, lanes and colors (or hid a branch) after refs moved while the newest commit stayed the same:
mainreset ontoorigin/main, a branch created on an existing commit, checkout of a previous branch,mainreset onto another branch's commit. Only a restart fixed it. Two caches keyed on the top commit alone were the cause:useGitRepo.tsloadLog): when the first page's top hash matched, the fresh page — with its fresh%Ddecorations — was thrown away, andLOG_CACHEwas restored on the same test. The earlier fixes forced a reload after in-app actions, but the watcher (terminal/IDE git), the integrated terminal, undo/Time Machine, PR checkout and the rebase banner still refreshed without force.CommitGraph.vue): the fingerprint was count + first + last hash + branch + WIP, and the main/master lane-0 pin was re-detected only when the top commit changed.What
loadLogcompares the fresh first page against the held log and the cache by hash and refs (samePageDecorations). On any difference it takes the fresh rows, drops that repo'sLOG_CACHEand re-prefetches; an idle poll keeps the same array and spawns nothing extra.repoRefresh(true)), so ref moves deeper than the first page are seen too.loadLoggets a request number and only the latest applies; a superseded forced reload hands its force to the next call. A fetch landing after a repo switch is dropped.loadMoreLog(_logGen,_prefetchToken), which could previously append a page at a stale--skipoffset and leave a gap that was then cached.loadLogsees rows change, if it was already loaded — this also covers the poller path when the live watcher is off. A list landing after a repo switch is ignored.utils/graphLayoutPin.ts: refs signature (FNV-1a hash, one pass), trunk detection, and the rule "keep the pin only on a pure append". CommitGraph uses it, so lanes and the trunk follow ref moves.Tests
useGitRepo-log-ref-moves.test.ts(9, real git repos behind a mocked IPC): reset of main under an unchanged top, new branch on an existing commit, idle poll keeps the array, no stale cache restore after switching repos, in-flight page doesn't leave a gap, out-of-order results, superseded forced reload still sees a deep branch, branch list reloaded on change but not on an idle poll / not loaded when lazy. Most fail againstmain.graphLayoutPin.test.ts: the issue's cases 1 and 3, main moved onto another branch's commit, new branch, no-change cache hit, append keeps the pin, origin/main as trunk, signature size with 5000 tags.vue-tscclean.Before merging