@gitkraken/core-gitlens 0.37.1 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +60 -1
  2. package/dist/git/cache.d.ts +128 -8
  3. package/dist/git/cache.js +425 -46
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/features.d.ts +1 -1
  6. package/dist/git/features.js +3 -0
  7. package/dist/git/features.js.map +1 -1
  8. package/dist/git/providers/branches.d.ts +42 -1
  9. package/dist/git/providers/diff.d.ts +17 -0
  10. package/dist/git/providers/provider.d.ts +7 -0
  11. package/dist/git/providers/shared/remotes.js +8 -4
  12. package/dist/git/providers/shared/remotes.js.map +1 -1
  13. package/dist/git/remotes/matcher.js +2 -2
  14. package/dist/git/remotes/matcher.js.map +1 -1
  15. package/dist/git/repositoryService.d.ts +16 -1
  16. package/dist/git/repositoryService.js +51 -3
  17. package/dist/git/repositoryService.js.map +1 -1
  18. package/dist/git/run.types.d.ts +1 -0
  19. package/dist/git/service.js +6 -2
  20. package/dist/git/service.js.map +1 -1
  21. package/dist/git/utils/fileStatus.utils.d.ts +5 -0
  22. package/dist/git/utils/fileStatus.utils.js +18 -1
  23. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  24. package/dist/git/watching/changeEvent.d.ts +13 -3
  25. package/dist/git/watching/changeEvent.js +15 -4
  26. package/dist/git/watching/changeEvent.js.map +1 -1
  27. package/dist/git/watching/changeOrdinal.d.ts +9 -0
  28. package/dist/git/watching/changeOrdinal.js +14 -0
  29. package/dist/git/watching/changeOrdinal.js.map +1 -0
  30. package/dist/git/watching/unwatchedCacheValidator.d.ts +38 -5
  31. package/dist/git/watching/unwatchedCacheValidator.js +180 -36
  32. package/dist/git/watching/unwatchedCacheValidator.js.map +1 -1
  33. package/dist/git/watching/watchGroup.d.ts +63 -14
  34. package/dist/git/watching/watchGroup.js +213 -74
  35. package/dist/git/watching/watchGroup.js.map +1 -1
  36. package/dist/git/watching/watchService.js +4 -3
  37. package/dist/git/watching/watchService.js.map +1 -1
  38. package/dist/git/watching/watchSession.d.ts +10 -2
  39. package/dist/git/watching/watchSession.js +18 -4
  40. package/dist/git/watching/watchSession.js.map +1 -1
  41. package/dist/git/watching/watcherPatterns.d.ts +18 -4
  42. package/dist/git/watching/watcherPatterns.js +39 -8
  43. package/dist/git/watching/watcherPatterns.js.map +1 -1
  44. package/dist/git/watching/worktreeSummary.d.ts +23 -12
  45. package/dist/git/watching/worktreeSummary.js +164 -41
  46. package/dist/git/watching/worktreeSummary.js.map +1 -1
  47. package/dist/git-cli/cliGitProvider.d.ts +1 -0
  48. package/dist/git-cli/cliGitProvider.js +11 -2
  49. package/dist/git-cli/cliGitProvider.js.map +1 -1
  50. package/dist/git-cli/exec/git.d.ts +7 -2
  51. package/dist/git-cli/exec/git.js +46 -10
  52. package/dist/git-cli/exec/git.js.map +1 -1
  53. package/dist/git-cli/exec/headState.d.ts +24 -0
  54. package/dist/git-cli/exec/headState.js +46 -6
  55. package/dist/git-cli/exec/headState.js.map +1 -1
  56. package/dist/git-cli/parsers/logParser.js +6 -3
  57. package/dist/git-cli/parsers/logParser.js.map +1 -1
  58. package/dist/git-cli/providers/branches.d.ts +135 -10
  59. package/dist/git-cli/providers/branches.js +622 -80
  60. package/dist/git-cli/providers/branches.js.map +1 -1
  61. package/dist/git-cli/providers/commits.d.ts +16 -0
  62. package/dist/git-cli/providers/commits.js +80 -28
  63. package/dist/git-cli/providers/commits.js.map +1 -1
  64. package/dist/git-cli/providers/config.d.ts +10 -0
  65. package/dist/git-cli/providers/config.js +50 -12
  66. package/dist/git-cli/providers/config.js.map +1 -1
  67. package/dist/git-cli/providers/contributors.js +11 -7
  68. package/dist/git-cli/providers/contributors.js.map +1 -1
  69. package/dist/git-cli/providers/diff.d.ts +12 -0
  70. package/dist/git-cli/providers/diff.js +107 -15
  71. package/dist/git-cli/providers/diff.js.map +1 -1
  72. package/dist/git-cli/providers/graph.js +32 -25
  73. package/dist/git-cli/providers/graph.js.map +1 -1
  74. package/dist/git-cli/providers/operations.d.ts +37 -3
  75. package/dist/git-cli/providers/operations.js +124 -46
  76. package/dist/git-cli/providers/operations.js.map +1 -1
  77. package/dist/git-cli/providers/patch.js +1 -1
  78. package/dist/git-cli/providers/patch.js.map +1 -1
  79. package/dist/git-cli/providers/refs.d.ts +1 -1
  80. package/dist/git-cli/providers/refs.js +10 -11
  81. package/dist/git-cli/providers/refs.js.map +1 -1
  82. package/dist/git-cli/providers/status.d.ts +4 -5
  83. package/dist/git-cli/providers/status.js +36 -33
  84. package/dist/git-cli/providers/status.js.map +1 -1
  85. package/dist/git-cli/providers/tags.d.ts +8 -0
  86. package/dist/git-cli/providers/tags.js +53 -34
  87. package/dist/git-cli/providers/tags.js.map +1 -1
  88. package/dist/git-cli/service.d.ts +15 -0
  89. package/dist/git-cli/service.js +19 -1
  90. package/dist/git-cli/service.js.map +1 -1
  91. package/dist/plus/git-github/providers/github/diff.d.ts +1 -0
  92. package/dist/plus/git-github/providers/github/diff.js +6 -1
  93. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  94. package/dist/plus/integrations/integrationService.js +9 -0
  95. package/dist/plus/integrations/integrationService.js.map +1 -1
  96. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  97. package/dist/plus/integrations/providers/jira-server.js +1 -1
  98. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  99. package/dist/plus/integrations/providers/jira.d.ts +38 -6
  100. package/dist/plus/integrations/providers/jira.js +111 -69
  101. package/dist/plus/integrations/providers/jira.js.map +1 -1
  102. package/dist/plus/integrations/providers/linear.d.ts +31 -3
  103. package/dist/plus/integrations/providers/linear.js +77 -18
  104. package/dist/plus/integrations/providers/linear.js.map +1 -1
  105. package/dist/plus/integrations/providers/utils/discoveryCache.d.ts +41 -4
  106. package/dist/plus/integrations/providers/utils/discoveryCache.js +50 -11
  107. package/dist/plus/integrations/providers/utils/discoveryCache.js.map +1 -1
  108. package/dist/plus/integrations/reads/drains.d.ts +1 -0
  109. package/dist/utils/env/node/exec.d.ts +5 -4
  110. package/dist/utils/env/node/exec.js +52 -9
  111. package/dist/utils/env/node/exec.js.map +1 -1
  112. package/dist/utils/holdOffMap.d.ts +23 -0
  113. package/dist/utils/holdOffMap.js +43 -0
  114. package/dist/utils/holdOffMap.js.map +1 -0
  115. package/dist/utils/promiseCache.d.ts +15 -2
  116. package/dist/utils/promiseCache.js +34 -4
  117. package/dist/utils/promiseCache.js.map +1 -1
  118. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,64 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.38.0] - 2026-11-13
10
+
11
+ ### Added
12
+
13
+ - Adds `Cache.setRepoPathRegistrar`, which has a checkout registered before its first read through `GitService.forRepo`, so a host that registers checkouts in the background no longer has a linked worktree read as a repository of its own and its reads thrown away at registration. A host sets it once it has the service, as a function that resolves the checkout's git dir through `forRepo(path).config.getGitDir()` and calls `registerRepoPath`, and that answers `undefined`, synchronously, for a path it declines. Each per-repository sub-provider method that answers only a promise then starts once the registration settles; the others (synchronous ones, async iterables, and the git dir reads a registrar makes) call straight through. Concurrent first reads share one ask, a failing registrar lets the read go ahead unregistered, and a slow one is waited on for at most 10 seconds. The watch service's gitignore filter waits the same way before it reads the shared ignore config. Adds `GitProvider.ensureRegistered` and `Cache.ensureRegistered`; a host that sets no registrar sees no change (git, git-cli)
14
+ - Adds `paths` to `diff.getDiffStatus`: limits the status to those paths, matched literally (a name with glob characters matches only itself), batched to fit the command line. An empty list resolves `undefined` without running git, `paths` wins over `path` (for the untracked files `includeUntracked` merges in too), and a file reached by overlapping paths is listed once. A rename whose two sides fall in different batches reads as a delete and an add. A GitHub repository filters its comparison by the same rule, keeping a rename whole when either side is among the paths (git, git-cli, git-github)
15
+ - Adds `renames` and `similarityThreshold` to `diff.getDiff` and `diff.getParsedDiff`: `renames: true` passes `-M` (at `similarityThreshold` or the configured one), as `getDiffStatus` always does, so the hunks agree with its list; `renames: false` passes `--no-renames`; omitted, `diff.renames` decides as before (git, git-cli)
16
+
17
+ ### Changed
18
+
19
+ - **Breaking (git)** — `shouldIgnoreWorkingTreePath` (`git/watching/watcherPatterns.js`) takes a path relative to the checkout's root rather than an absolute one, and matches only whole `.git` and `node_modules` segments and a segment starting `.watchman-cookie-`: given an absolute path it would again judge the folders above the checkout. Adds `createWorkingTreeNoiseFilter(repoPath)`, which returns the check for absolute event paths under that checkout
20
+ - **Breaking (git-cli)** — `config.getConfigRegex` rejects when git could not read the configuration (the run failed to start, timed out or exited abnormally) where it answered an empty map; git's "no key matched" is still an empty map. A caller that read a failure as "nothing set" must catch it and pick its own fallback (see the fix below)
21
+ - Changes a git run that is given no input to start with stdin closed (`stdio[0]` is `'ignore'`) rather than with a pipe it never wrote to, which saves a pipe for every git process. A host `spawn` (`GitOptions.spawn`) now sees `'ignore'` for those runs, as it already did for streamed ones (utils, git-cli)
22
+ - Speeds up the untracked half of `status.hasWorkingChanges`, which worktree summaries read `dirty` from, on a checkout with a large untracked folder: git reports an untracked folder as one entry (`ls-files --directory --no-empty-directory`) rather than listing every file in it before the first one is read. The answer is the same. It applies on git 2.27 or later, where git's directory walk was reworked; older git lists every file as before. Adds the `git:ls-files:directory` feature (git, git-cli)
23
+ - Changes the cached git results (merge bases, ref and revision lookups, single-commit reads, the remotes listing) to stay cached across an index or working-tree change, which none of them read: a `git add` in one worktree, a fetch that moves no ref (`lastFetched`), or a `clearCaches` of `blame`, `diff`, `fileLog` or `tracking`, no longer drops them for every worktree of the repository. Ref, config, stash, status and worktree changes clear them as before, and a run that names `FETCH_HEAD` is never cached (git, git-cli)
24
+ - Speeds up a single-commit read (`commits.getCommit`) of a merge commit or a stash: on git 2.31 or later it diffs the commit against its first parent only (`--diff-merges=first-parent`), where `-m` had git diff it against every parent and core kept the first. The commit and the files returned are the same; older git keeps `-m`. Adds the `git:log:diff-merges` feature (git, git-cli)
25
+ - Changes `validateUnwatchedCaches` to take the first baselines of a repository's registered worktrees together: the first validation of a worktree nothing validated yet also reads the git dirs of its unwatched, never-validated siblings (up to 64 a validation), so the repository's shared entries (branch list, refs, default branch, cached git results) are cleared once, where each worktree's first read or watcher attach cleared them again and re-ran the ref listing. A sibling still checks its own git dir at its first read, against that baseline. Worktrees registered after that first validation take theirs as before (git)
26
+ - Changes `validateUnwatchedCaches` so a linked worktree registered after its repository's first validation no longer clears the repository's shared entries (branch list, refs, default branch, cached git results) at its own first validation: once the common git dir holds a reading of that worktree's HEAD, its first report clears only its own entries, costing a read of its current branch where it cost a ref listing for every worktree registered late. More than three such worktrees in one validation still clear the shared entries once, which the ref listing then re-seeds. Adds `Cache.applyLinkedWorktreeChanges` for it (git)
27
+ - Changes a change to what a repository's checkouts share (a ref moving, a tag, a remote) to evict the shared ref listing, its ref tips and tags, a remote's default branch and the cached git results once rather than once per watched checkout. Every watched checkout reports such a change, each after its own debounce, and each report evicted them again, so a read made between two reports was thrown away and repeated. A watcher's event now carries `observedAt` (`WatcherRepoChangeEvent.observedAt`, an ordinal from `nextChangeOrdinal` in `git/watching/changeOrdinal.js`, absent for a change a host injects or a rescan reports), `Cache.onRepositoryChanged` and `applyRepositoryChanges` take it, and a report skips the shared entries that an eviction after its change already dropped whole. Each checkout's own entries, and every shared entry not known to be read from git alone, are evicted by every report as before; a host that doesn't pass `observedAt` sees no change. Adds `RepoPromiseCacheMap.has` (git, git-cli, utils)
28
+ - Changes a cached git run (`caching` in `GitRunOptions`) to keep an answer that git gives as an exit code the caller listed in `expectedExitCodes`, as it keeps one that exits 0, for the same lifetime and with the same sharing of a run in flight. The base read's `merge-base` (no fork point, or no common ancestor, exit 1) and `getSymbolicReferenceName` / `getSymbolicReferenceNameOrMissing` (no upstream or no such ref, exit 1) no longer spawn git again on every read to be told "no" again; a ref, config or HEAD change clears them like any other cached result. A non-zero exit the caller did not list, a run that did not exit and a run cancelled or aborted are still not kept (git-cli)
29
+ - Changes `branches.getAheadOfBaseAfterBaseMove` to also re-measure a base that is a remote-tracking ref (`origin/main`) when the local default branch tracking it (`main`) moved: alone (a merge, a commit, a reset), keeping the previous answer, or together with the base (a pull). Every worktree measured against `origin/main` read its base in full on each such move (4 git processes each); now each spawns none of its own. The worktrees share a read of `main`'s reflog, and, unless `main` is at the base's tip, one count of the checked-out branches past `main`'s tip and one past each fork point. It answers only when `main` provably still loses to the base, because HEAD shares nothing past the base's fork point with `main`'s tip or reflog. Still read in full: a `main` that holds the branch's own commits, a `main` with an empty reflog or one that doesn't end at its tip, a base that isn't the default branch's tracking ref, another branch tracking `main` locally, an `upstream` remote's copy of the base, a shallow repository, and a rewritten base moving along with `main`; and, where counts are needed, a HEAD that no checked-out branch is at, or git before 2.41. A worktree summary still reads the base in full once its last full read is five minutes old or twenty shortcut answers back, and never re-measures an answer whose full read fell back past a read that failed inside it, which `getAheadOfBase` now marks `provisional` (git, git-cli)
30
+ - Adds `branches.getAheadOfBaseAfterCommit`, which carries a `getAheadOfBase` answer past one ordinary commit on the branch, answering it one commit further ahead only when that provably equals a full read: one `rev-list --parents` shows the new HEAD's only parent is the HEAD last read and that no tip or reflog value of a ref the base depends on reaches it. A worktree summary tries it when HEAD moved on the same branch with nothing else its base depends on moved (by the tips it was read from), in a watched worktree or one without a subscription. Each commit read its base in full (4 git processes or more); now it runs 1. The count carried must be the last HEAD's, so for a host that validates unwatched caches (`validateUnwatchedCaches`, which sets `Cache.setReadValidator`) `getAheadOfBase` on a branch checked out in the checkout read now measures every count, fork point and merge base from the branch's tip as the cached ref list gives it, the list the summary's own HEAD comes from, rather than from HEAD as git finds it, which a commit landing during the read has moved, and reports that commit as `AheadOfBase.measuredFrom` (absent for a detached HEAD, a branch the list doesn't name or place there, or git before 2.23); for any other host nothing keeps that list current, so the count is taken from HEAD as before and reports no `measuredFrom`. An answer measured from the last HEAD is carried as it is, the carried answer is measured from the new HEAD, and only one measured from elsewhere, which includes the first carry after a full read by a host that doesn't validate, costs a second process, a `rev-list --count` of the last HEAD past the base's tip. A reset or fast-forward onto such a commit is carried the same way. Still read in full: an amend, a merge, a rebase, a move onto a commit with another parent or one a depended-on ref's tip or reflog holds, several commits between reads, a detached HEAD, a base or default branch that changed, a created-from branch or `upstream` copy of a candidate that appeared, a branch with nothing counted past its fork point, a fork point off the base's history, a preferred target, the default branch measured against an upstream it contains, a commit whose subject reads as the branch's creation, and a shallow, grafted, reftable or replace-ref repository. A worktree summary still reads the base in full once it has carried an answer for five minutes or twenty shortcut answers since its last full read, and never carries an answer marked `provisional` (git, git-cli)
31
+ - Speeds up a full base read (`branches.getAheadOfBase`, which a worktree summary runs when it subscribes) by two git processes in each linked worktree. The name a branch was created from is read from the branch's reflog file rather than by `git reflog show --grep-reflog`. A local branch's upstream (`main@{u}`) is asked once in the main checkout and shared by the repository's worktrees, where each worktree asked its own, once the base read has the config listing (as a worktree summary's does). The answers are the same. Git is still asked in each worktree when its config can differ from the main checkout's (`extensions.worktreeConfig`, or a conditional include other than `gitdir:` or `hasconfig:`). It is still asked for the created-from name in a reftable repository, when the reflog file can't be read or parsed, and for a branch the cached ref list doesn't name (git-cli)
32
+ - Changes `branches.getLocalBranchByUpstream`, `tags.getTag`, `refs.hasBranchOrTag` and the branch check in `patch.applyUnreachableCommitForPatch` (and so `getBranchMergedStatus` and `refs.getReference`) to answer from the branch and tag lists the repository's worktrees share, mapping only the branch or tag they return or a predicate judges, so they no longer build and keep a worktree's own copy of either list. The answers are the same, including a worktree's current, detached or rebasing branch, and `hasBranchOrTag` now reads the tags only when no branch matched. Adds `Cache.getSharedTags`, `branches.hasBranch` and `tags.hasTag` (git, git-cli)
33
+ - Changes `branches.getDefaultBranchName` (without `local`), when `refs/remotes/<remote>/HEAD` is missing, to run `git remote set-head -a` and `git ls-remote --symref` without credential prompts and with a 10 second limit, where they could prompt and wait out a full minute. A failed attempt (the host unreachable, a login refused, the limit passed) is not repeated for that remote for a minute, or until the repository's cached default branch is dropped (a change to its remotes or branches, a close or reset): the lookup answers `undefined` from its local `symbolic-ref` read without launching either, and keeps no answer. A caller cancelling during either run now rejects the lookup, which answered `undefined` before. `Cache`'s drop stamps (`getDropStamp`, `isDroppedSince`) now cover `'defaultBranchName'`, kept per repository (git, git-cli)
34
+ - Changes a page of commits read with file details and a page size (`commits.getLog`) to have the time limit a git run has (`GitOptions.gitTimeout`, 60 seconds by default) on its first attempt, where it had none. A page that runs out of time is read again with git's default rename limit (`-l1000` after `-M`, over core's unlimited `diff.renameLimit`) and returned, so only a commit with more rename candidates than that shows its edited, moved files as a delete and an add; exact and same-name moves, and every other commit on the page, keep their renames. The single-commit read (`getLog` with a limit of one, `commits.getCommit`), which failed every time on such a commit, is read again the same way when it runs out of time. The repository then reads its pages and single commits that way for ten minutes before trying unlimited renames again. A caller cancelling is not a timeout and is not remembered, and the second read gets no limit of its own. `GitLog` carries no flag that renames were limited (git-cli)
35
+ - Changes how a repository whose main checkout and a linked worktree are both watched watches its common git dir: the main checkout's `.git` watcher now also tells the linked worktrees of the files they share (config, refs, `packed-refs`, `FETCH_HEAD`, `info/exclude`, the worktree list), so the host's `FileWatchingProvider` is asked for one watcher fewer on that directory, and each shared change is classified, the shared config read and the worktree list rescanned once rather than twice. The shared-files watcher is created only while no main checkout is watched; when one watcher takes the shared files over from the other, the outgoing one keeps telling the linked worktrees of them for a few seconds beside the new one, so a watch the host places asynchronously misses nothing in between. A polled repository likewise polls the common dir once, and a polled linked worktree now hears a change to a ref only the main checkout names, as a watched one does. Adds `isGitDirCommonPath` to `git/watching/watcherPatterns.js` (git)
36
+ - Changes `diff.getDiffStatus` to read an unborn `HEAD` (a repository before its first commit) and a root commit's missing parent (`<sha>^` against `<sha>`, as a pair or a range) against the empty tree, as `diff.getDiff` already does for an unborn `HEAD`, instead of failing; a root commit is told by having no parent (`rev-list --parents`), never from git's error text (git-cli)
37
+ - Changes `diff.getDiff` of a single commit with no `from` to diff a root commit against the empty tree instead of failing on its missing `<sha>^` (git-cli)
38
+ - Changes git diff reads to ignore a repository's `diff.noprefix`, `diff.srcPrefix`, `diff.dstPrefix`, `diff.interHunkContext`, `diff.suppressBlankEmpty` and `diff.submodule`, as they already ignore `diff.mnemonicPrefix`, and `diff.getDiff` to skip an external diff tool (`--no-ext-diff`), as `getDiffStatus` already does, so every caller gets the same hunks whatever the config: file headers keep their `a/` and `b/` prefixes, hunks join by git's default rule, a blank context line keeps its leading space, and a submodule change is a normal `diff --git` section rather than a log glued onto the previous file. This also fixes `getParsedDiff` finding no files under `diff.noprefix` or custom prefixes, numbering every line after a blank context line one too low under `diff.suppressBlankEmpty`, and reading a submodule's log as context lines of the previous file under `diff.submodule=log`, and `getDiff` failing or answering the tool's output under `diff.external` (git-cli)
39
+
40
+ ### Fixed
41
+
42
+ - Fixes Linear autolinks keeping an incomplete team list cached for the whole discovery TTL instead of retrying discovery ([#6177](https://github.com/gitkraken/vscode-gitlens/issues/6177)) (plus/integrations)
43
+ - Fixes Jira Cloud and Linear autolinks re-reading, and waiting on, the provider on every call while the sites, a site's projects, the Linear organization or its teams can't be read whole; that set is now kept, with the last prefixes of a site that failed, and retried in the background after a minute ([#6183](https://github.com/gitkraken/vscode-gitlens/issues/6183)) (plus/integrations)
44
+ - Fixes Jira Cloud and Linear autolinks after a newer read replaces a site's project list or the team list while an autolink build is in flight: a render no longer joins the build started before the replacement, an older read landing last no longer puts its list back for the discovery TTL nor answers with it, a later build's empty fallback no longer blocks the set the retired build kept, a Jira site whose projects keep failing keeps the prefixes of its last list stored once the replacement dropped the set, and the same list read again no longer drops a complete set nor retires the build in flight ([#6184](https://github.com/gitkraken/vscode-gitlens/issues/6184)) (plus/integrations)
45
+ - Fixes a git run never settling when its output could not be decoded: output longer than the engine's longest string, a non-UTF-8 `encoding` with no `decode` configured, or a `decode` that throws. The run now rejects with that error. Before, its caller waited for good, identical runs joined it, and it kept one of the queue's process slots (utils, git-cli)
46
+ - Fixes working-tree changes never being reported for a checkout under a folder whose name ends in `.git` (a bare repository with its worktrees inside it, `app.git/feature`) or under a `node_modules` folder: the watch service matched its `.git` and `node_modules` noise filter against the whole path, so every change in such a checkout was dropped. It now judges only the path inside the checkout, and only whole `.git` and `node_modules` segments, so a tracked folder such as `fixtures/repo.git/` is reported too. `shouldIgnoreWorkingTreePath` (`git/watching/watcherPatterns.js`) follows, see Changed (git)
47
+ - Fixes a page of commits coming back empty when one of its commits changed a very large number of files (around 100,000 or more): collecting that commit's files overflowed the call stack, which failed the whole read (git-cli)
48
+ - Fixes caches that are written without a read never dropping their expired entries or holding to their capacity, so they grew for the life of the process: the config key caches (keyed by branch name, per checkout) and the copies a linked worktree keeps of answers its repository shares (merged status, contributors, branch overviews, stashes). `PromiseCache.set` now trims as `getOrCreate` does, and writes made together share one trim rather than each running its own pass over the cache (utils, git)
49
+ - Fixes a removed checkout leaving an empty cache behind in every per-repository cache it had used: `RepoPromiseCacheMap` now drops a repository's cache once an eviction empties it, so `size` counts only repositories that hold entries. One still holding an in-flight entry stays, and a new caller still joins that entry (utils)
50
+ - Fixes six reads keeping a failed git read as their answer until an unrelated change cleared it: `tags.getTags` and `refs.getRefTips` (no tags, no tips, after a ref listing that failed), `remotes.getBestRemotesWithProviders` (no remotes, after a failed remote listing), `commits.getInitialCommitSha`, `config.getCurrentUser` (no user, after a read that threw) and `contributors.getContributorsStats`. A failed read now answers as before but isn't kept, so the next call reads again; a real empty answer (no refs, no remotes, a repository with no commits yet) is still kept and costs no git process on a repeat. `getInitialCommitSha` now answers `undefined`, not an empty string, when there is none. A read of the current user that keeps failing (a bad config line, a run past its time limit) is retried after a minute, or at once when the config changes, rather than on every call (git, git-cli)
51
+ - Fixes `contributors.getContributorsStats` entries read without `since` or `timeout` never expiring: they passed an undefined lifetime that overrode the cache's default hour (git-cli)
52
+ - Fixes core's working-tree reads rewriting a checkout's index: `status.hasWorkingChanges` and `getWorkingChangesState` (which worktree summaries read `dirty` from), `diff.getDiff`, `getDiffStatus`, `getChangedFilesCount` and `getDiffForFile` each ran a `git diff` that, when a tracked file's timestamps had moved but its content had not (a formatter rewriting the same bytes, a tool touching files), refreshed the index and wrote it. That briefly held `index.lock` in a checkout where a user's or an agent's `git add` or commit could then fail, and the write came back as an index change that ran the read again. On git 2.46 or later they now run with `diff.autoRefreshIndex=false`, as `git status` already ran with `GIT_OPTIONAL_LOCKS=0`; their answers are unchanged, and git compares such a file's content on each read until a git command refreshes the index. An older git reads such a file as changed with that setting, so it keeps refreshing. Adds the `git:diff:autoRefreshIndex:off` feature and `Git.getDiffReadConfigs` (git, git-cli)
53
+ - Fixes `validateUnwatchedCaches` serving a stale branch list after an unwatched linked worktree switched branches: the branch list read from any other checkout kept showing the old branch as checked out there, until the worktree list or that worktree itself was read. The common git dir reported the move as a `worktreeHead`, which clears the worktree list but nothing shared, and only the worktree's own report cleared the rest. A linked worktree's HEAD move seen in the common git dir is now applied as that worktree's own `head` report, at the next validation in its repository, or when its watcher leaves without having reported it. Only a read from an unwatched checkout validates: for a repository read solely through watched checkouts, see the fix for a watcher's report of another worktree's checkout (git)
54
+ - Fixes four shared git reads rejecting a caller that never cancelled when the first caller to ask cancelled: `commits.getInitialCommitSha`, `getLeftRightCommitCount`, `getCommitReachability` and `getLogShas` ran their one shared git process under the first caller's abort signal, so that abort killed it and every caller riding along got a `CancellationError`. The process now stops only when every caller has aborted, and a caller that aborts is itself rejected. `Cache.getInitialCommitSha` takes the caller's `cancellation` and hands its factory the shared `signal` (git, git-cli)
55
+ - Fixes a failed `git config --get-regexp` being kept as "no matching keys": `config.getConfigRegex` now rejects when the run failed to start, timed out or exited abnormally, and still answers an empty map, kept, for git's exit code 1 (no key matched). `config.getCurrentUser` answers no user for a failed read rather than the environment or operating-system user, and keeps nothing; `config.getSigningConfig` answers its defaults for a failed read, uncached; a failed read in `branches.getCurrentBranchReference`'s default-branch fallback is not kept; and the follow-remote-HEAD step after a fetch skips a failed read and tries again after the next fetch. Adds `HoldOffMap` (`utils/holdOffMap.js`), a bounded map of keys held off for a fixed wait, which the failed-read waits here are kept in (git, git-cli, utils)
56
+ - Fixes `excludeIgnoredUris` and `getIgnoredUrisFilter` answering from gitignore rules that had since changed in a repository nothing watches: only a working-tree watcher refreshed the kept rules, so an edited `.gitignore`, `info/exclude`, global excludes file or `core.excludesFile` was never seen. Both now check the files the rules were read from, at the cost of one stat each, and reload when one changed (git-cli)
57
+ - Fixes the move of legacy `branch.*.gk-*` keys from `.git/config` into `.git/gk/config` being abandoned for good after one failed read: the empty `.git/gk/config` that marks a repository as migrated was created before the legacy keys were read, so a `git config` run that failed once left the marker behind and the stored merge bases and targets were never moved. The marker is now created only after the read succeeds, and a failed read is tried again in the next session (git-cli)
58
+ - Fixes the worktree summary service re-running the whole base read on every change in a worktree once that read had failed, file saves included, each holding one of the repository's read slots for as long as git took to fail again. A change now reads only what it affects. The base is read again at once when something it depends on changes (one of its refs, HEAD, its stored merge targets or config inputs), and otherwise with the next change once a wait is over, which starts at a few seconds and doubles with each failure in a row up to five minutes. `WorktreeSummary.stale` stays set until a base read succeeds, and a failed read of anything else still reads everything next time. A worktree read without a subscription reuses the fresh parts of its last read the same way (git)
59
+ - Fixes `maxBuffer` being ignored by git runs: `runSpawn` collected stdout and stderr without limit whatever the option said. A run given a `maxBuffer` whose stdout or stderr passes it is now killed and rejects with a `RunError` whose `code` is `ERR_CHILD_PROCESS_STDIO_MAXBUFFER`. A run given none is unlimited, as before, and the option's documentation now says so (git, utils)
60
+ - Fixes the branch list read from a watched checkout showing a branch as still checked out in a linked worktree that had switched branches outside core, until the worktree list was read: the watcher's report of that worktree's HEAD (`worktreeHead`) cleared the worktree list and that worktree's current branch, but not the shared ref listing and branch lists that say which branch is checked out where. It now drops those for the repository, and so does core's own `worktrees.createWorktree` and `deleteWorktree`, whose new or removed worktree on an existing branch went unseen the same way. The cost is one ref listing for the repository at the next branch-list read after another worktree's checkout, however many of its checkouts are watched: each watched checkout reports the move, and a report skips the drop when one after its change already made it (`observedAt`). A branch first checked out there also has its cached base read again (`branches.getBaseBranchName`), once the next ref listing shows it there, where it stayed "no base" for up to five minutes. An empty `movedWorktrees` passed to `Cache.onRepositoryChanged` or `applyRepositoryChanges` is now taken as naming no worktree known, as when it is absent (git, git-cli)
61
+ - Fixes a hung `git ls-files` leaving `status.hasWorkingChanges` (its untracked check), `getWorkingChangesState` and `hasConflictingFiles` waiting until the status read's backstop, twice the git timeout, gave up on it. The two streamed checks (`ls-files --others` and `ls-files --unmerged`) now carry the limit a git run has (`GitOptions.gitTimeout`, 60 seconds by default), kill git when it passes, and reject with the `CancellationError` (reason `timeout`) a timed-out run rejects with (git-cli)
62
+ - Fixes ignore rules going stale after a nested `.gitignore` that matches its own rules (one containing `*`, say) was edited or deleted. The working-tree watcher skipped a change to a nested `.gitignore` when the file itself read as ignored, so the old rules kept hiding changes; it now skips one only when its directory is ignored, as git does (git)
63
+ - Fixes a git read cancelled partway through its output being returned, and sometimes kept, as a complete answer. A page of commits came back short with no more to load, a file's history or contributors list was served cut short to later callers, and a commit graph refresh replaced the window with a truncated one. A stream whose caller aborts now rejects with a `CancellationError`, as a run does, so a host that cancels such a read gets that rejection where it got a short result; a reader that stops early still ends quietly, a cancelled graph page keeps its rows and reports more to load, and a contributors read that ran out of its own time now says `timedout` rather than `cancelled` and is not kept. A stream its own time limit or an outside SIGTERM killed now rejects with a `CancellationError` too (reason `timeout` or `unknown`, wrapping the `CancelledRunError` it rejected with before), as a run does, so a page of commits that runs out of time outside the rename fallback rejects where it answered `undefined`; a reader that already stopped still ends quietly when git is killed afterwards. A git error after a reader stopped early, which nothing awaited, no longer surfaces as an unhandled promise rejection; it is still logged, and a reader that breaks out of `git.stream` itself still gets it (git-cli)
64
+ - Fixes a caller that never cancelled getting a `CancellationError` from a read every earlier caller had abandoned. Once all of them cancelled, a linked worktree's next caller of a read it shares with its repository (tags, remotes, worktrees, stashes, contributors, branch overviews, merged status) started a fresh read but was still handed the worktree's copy of the abandoned one, and `commits.getLogForPath` could serve such an entry too. A worktree's copy is now reused only while it was made from the shared read in use, and `PromiseCache.get` and `PromiseMap.get` no longer return an entry in flight whose callers have all cancelled (utils, git)
65
+ - Fixes `ops.pull` announcing every local and remote-tracking branch as possibly moved: it named no ref, so a host had to refresh each worktree of the repository in full after any pull, and every worktree's summary checked its refs' tips again. A pull now reads the refs it may move before and after it runs, as a fetch does (every local branch, tags, the stash, and what the remotes' fetch refspecs store; two `for-each-ref` processes, plus one `git config` read of the refspecs when it isn't cached yet), and names those that moved: a fast-forward of `main` names `refs/heads/main` and `refs/remotes/origin/main`, so the other worktrees hear only those, and the ones following neither skip their refresh. A ref kind nothing moved is left out, a tag the pull fetched is announced as `tags`, by name, the stash an autostash left when restoring it conflicted as `stash`, and a fast-forward-only pull of a branch checked out nowhere names that branch, as `fetch` does. A pull that leaves HEAD detached (a rebase that stopped on a conflict) also announces `worktrees` and `worktreeHead`, as a checkout does, so the other worktrees stop showing its branch as checked out there, and a pull that rewrote the HEAD file (a rebase that replayed commits) announces `worktreeHead` too, since its siblings' watchers report that rewrite; both are told from the HEAD file read before and after the pull, with no git process, so they hold whichever way the pull was configured to rebase. When either read fails, or a ref of no kind an announcement can name moved, the pull announces its branches unnamed, as before. A fetch's or pull's second read no longer joins an identical one started before the write, which answered as if nothing moved, so the fetch announced nothing (git-cli)
66
+
9
67
  ## [0.37.1] - 2026-11-10
10
68
 
11
69
  ### Fixed
@@ -1226,7 +1284,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1226
1284
 
1227
1285
  - Initial release. Bundles `@gitlens/utils`, `@gitlens/git`, `@gitlens/git-cli`, `@gitlens/ai`, and `@gitlens/git-github` into a single core npm package with subpath exports.
1228
1286
 
1229
- [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.37.1...HEAD
1287
+ [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.0...HEAD
1288
+ [0.38.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.37.1...gitkraken:releases/core/v0.38.0
1230
1289
  [0.37.1]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.37.0...gitkraken:releases/core/v0.37.1
1231
1290
  [0.37.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.36.0...gitkraken:releases/core/v0.37.0
1232
1291
  [0.36.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.35.0...gitkraken:releases/core/v0.36.0
@@ -61,10 +61,10 @@ export interface MergeTargetsChangeEvent {
61
61
  }
62
62
  export type ConflictDetectionCacheKey = `apply:${string}:${string}:${string}` | `merge:${string}:${string}` | `reapply:${string}:${string}`;
63
63
  /**
64
- * Per-path caches whose drops are stamped, so a read can tell its entry was dropped mid-flight
65
- * (see {@link Cache.isDroppedSince})
64
+ * Caches whose drops are stamped, so a read can tell its entry was dropped mid-flight (see {@link Cache.isDroppedSince}).
65
+ * A shared cache's drops are stamped by common path, whichever of its checkouts' paths is asked about
66
66
  */
67
- export type DropStampedCacheKey = 'currentBranchReference' | 'currentUser';
67
+ export type DropStampedCacheKey = 'currentBranchReference' | 'currentUser' | 'defaultBranchName';
68
68
  export declare function shouldEvictBlameCacheEntry(progressive: ProgressiveGitBlame | undefined): Promise<boolean>;
69
69
  /**
70
70
  * Downstream caches that `deleteGkConfig` may invalidate when a `branch.<ref>.gk-...` key changes.
@@ -135,6 +135,8 @@ export declare class Cache implements Disposable {
135
135
  private _mergeTargetCheckoutGeneration;
136
136
  /** Each merge target answer's entry as `mergeTargets` stored it, so dropping a stale answer can't drop its successor */
137
137
  private _mergeTargetStored;
138
+ /** Each worktree's mapped entry of a shared read, to the shared entry it was mapped from */
139
+ private _mappedFrom;
138
140
  /** Advanced each time a drop-stamped cache's entries are dropped (see {@link getDropStamp}) */
139
141
  private _drops;
140
142
  /**
@@ -159,6 +161,20 @@ export declare class Cache implements Disposable {
159
161
  * `'worktreeHead'` report says moved (see {@link applyRepositoryChanges})
160
162
  */
161
163
  private _worktreeAdminIds;
164
+ /**
165
+ * Per common path, oldest first, the change ordinal (see `nextChangeOrdinal`) taken when each shared cache was last
166
+ * evicted whole for the repository with nothing read before left to serve or join (see {@link sharedCacheSources}),
167
+ * and when the ref listing, the shared branch list and every checkout's branch list were last so evicted together
168
+ * (`'branchPlacement'`, see {@link evictBranchPlacement})
169
+ */
170
+ private _sharedEvictions;
171
+ /**
172
+ * Linked worktrees whose HEAD a report moved without clearing the repository's base branch names, with the branch
173
+ * the ref listing cached then placed there (`undefined` when none was). The next listing that places another branch
174
+ * there drops that branch's cached base, which its first checkout may have just given it (see
175
+ * {@link dropBasesOwedOnCheckout})
176
+ */
177
+ private _basesOwedOnCheckout;
162
178
  /**
163
179
  * Per-commonPath snapshot of the subset of `.git/gk/config` that derived caches depend on — merge-relevant keys
164
180
  * ({@link branchOverviewGkConfigKeysRegex}) and branch metadata keys ({@link parseBranchMetadataGkConfigKey}) —
@@ -189,6 +205,13 @@ export declare class Cache implements Disposable {
189
205
  private _readValidator;
190
206
  /** What the read validator reports among {@link getResourceUsage}'s */
191
207
  private _readValidatorUsage;
208
+ /** Asked to register a checkout before its first read (see {@link setRepoPathRegistrar}) */
209
+ private _repoPathRegistrar;
210
+ /**
211
+ * Registrations still in flight, by checkout. `wait` is what a read waits on, `undefined` while the registrar runs
212
+ * synchronously (so its own reads go ahead) and once the wait timed out
213
+ */
214
+ private _registrations;
192
215
  [Symbol.dispose](): void;
193
216
  dispose(): void;
194
217
  /**
@@ -204,6 +227,28 @@ export declare class Cache implements Disposable {
204
227
  * costs among {@link getResourceUsage}'s.
205
228
  */
206
229
  setReadValidator(validator: ((repoPath: string) => Promise<void> | undefined) | undefined, getResourceUsage?: () => ResourceUsage): void;
230
+ /** Whether a read validator is set (see {@link setReadValidator}), so the host keeps the caches it covers current */
231
+ get readsAreValidated(): boolean;
232
+ /**
233
+ * Registers what registers a checkout (see {@link registerRepoPath}) before its first read through the service's
234
+ * per-repository sub-providers, since a checkout read before it is registered keeps its own copy of what its
235
+ * repository's checkouts share, which its registration then throws away. Asked by {@link ensureRegistered}, one ask
236
+ * at a time per checkout, until the checkout is registered. It registers the checkout itself, then answers a
237
+ * promise that settles once it did; it answers `undefined`, cheaply and synchronously, for a path it declines (one
238
+ * it doesn't know or trust), and is asked again at that path's next read. Its own reads of the checkout's git dir
239
+ * (`config.getGitDir`, `getRepositoryInfo`) go ahead without waiting on it, as does every read it makes before its
240
+ * first `await`; any other read it makes of that checkout through the service waits on it. `undefined` removes it.
241
+ * Kept across {@link reset}: it is host wiring, not cached state.
242
+ */
243
+ setRepoPathRegistrar(registrar: ((repoPath: string) => Promise<void> | undefined) | undefined): void;
244
+ /**
245
+ * Asks the registrar (see {@link setRepoPathRegistrar}) to register `repoPath` unless it is registered: `undefined`
246
+ * when there is nothing to wait for (no registrar, a path already registered or declined), or a promise, never
247
+ * rejecting, to read after. Concurrent calls for one path share one ask. A registrar that fails is logged and the
248
+ * read goes ahead unregistered; one that is slow is waited on for a while, after which reads go ahead and the path
249
+ * isn't asked again until it settles.
250
+ */
251
+ ensureRegistered(repoPath: string): Promise<void> | undefined;
207
252
  /**
208
253
  * Runs the read validator (see {@link setReadValidator}) for a read of one of its caches made without the wrappers
209
254
  * here: `undefined` when the read can go ahead at once, or a promise (that never rejects) to read after
@@ -264,6 +309,39 @@ export declare class Cache implements Disposable {
264
309
  * worktree's (see {@link dropLinkedCurrentBranches})
265
310
  */
266
311
  private applyLinkedHeadsMoved;
312
+ /**
313
+ * Clears what `changes` can have made stale in the linked worktree at `repoPath`'s own entries and status clock,
314
+ * leaving the shared (commonPath-keyed) ones alone, for a change that can't have moved what they hold. `inFlight` is
315
+ * as {@link applyRepositoryChanges}
316
+ */
317
+ applyLinkedWorktreeChanges(repoPath: string, changes: Iterable<RepositoryChange>, inFlight: 'share' | 'evict'): void;
318
+ /**
319
+ * Notes that `worktreePath`'s HEAD moved, with the branch the cached ref listing of `commonPath` placed there, unless
320
+ * a move not yet seen by a listing was noted already (see {@link _basesOwedOnCheckout})
321
+ */
322
+ private oweBaseOnCheckout;
323
+ /**
324
+ * Drops the cached base of each branch that `records`, a listing of `commonPath` started at drop stamp `at` (see
325
+ * {@link getDropStamp}), places in a worktree owing one, when it isn't the branch placed there before its HEAD moved.
326
+ * Only one branch per moved worktree is read again, where clearing every base would read one per worktree
327
+ */
328
+ private dropBasesOwedOnCheckout;
329
+ /**
330
+ * Whether `movedWorktrees` names no linked worktree but `repoPath`, whose own `'head'` reports its HEAD moving. An
331
+ * empty set names none known, which may be any
332
+ */
333
+ private movedOnlyItself;
334
+ /**
335
+ * Drops what says which branch is checked out in which worktree, for every worktree of `repoPath`'s repository: the
336
+ * ref listing, the shared branch list built from it, and each worktree's list mapped from that. Hard-deleted even
337
+ * when reads in flight would otherwise be shared, as one that listed the refs before the HEAD moved must not answer
338
+ * a read issued after it.
339
+ *
340
+ * A report stamped `observedAt` (see {@link applyRepositoryChanges}) skips it once all three were dropped together
341
+ * after that, with nothing read before left to serve or join: each holder rebuilt since was built from a ref listing
342
+ * started after the change was observed, so it already places the branches as the change left them.
343
+ */
344
+ private evictBranchPlacement;
267
345
  /** Drops what a `'branch'` eviction of `worktreePath` drops of its current branch, and nothing shared */
268
346
  private dropCurrentBranch;
269
347
  /**
@@ -274,6 +352,8 @@ export declare class Cache implements Disposable {
274
352
  getDropStamp(key?: DropStampedCacheKey, repoPath?: string): number;
275
353
  /** Whether `key`'s entry for `repoPath` was dropped after `stamp` was taken by {@link getDropStamp} */
276
354
  isDroppedSince(key: DropStampedCacheKey, repoPath: string, stamp: number): boolean;
355
+ /** The path `key`'s drops for `repoPath` are stamped by: its common path for a shared cache */
356
+ private getDropStampedPath;
277
357
  /** Stamps a drop of `keys`' entries for `repoPath`, or for every path when `undefined` */
278
358
  private onDropped;
279
359
  get conflictDetection(): RepoPromiseCacheMap<ConflictDetectionCacheKey, ConflictDetectionResult>;
@@ -330,7 +410,10 @@ export declare class Cache implements Disposable {
330
410
  * letting an in-flight read complete and share its answer with new callers is fine.
331
411
  */
332
412
  evictCaches(repoPath: string, ...types: CachedGitTypes[]): void;
333
- /** `worktreeOnly` leaves the shared (commonPath-keyed) entries alone (see {@link applyRepositoryChanges}) */
413
+ /**
414
+ * `worktreeOnly` leaves the shared (commonPath-keyed) entries alone, and `observedAt` skips those an eviction after
415
+ * it already dropped (see {@link applyRepositoryChanges})
416
+ */
334
417
  private clearCachesCore;
335
418
  /**
336
419
  * Evicts a single shared (commonPath-keyed) cache entry for `repoPath` and its sibling worktrees.
@@ -343,8 +426,23 @@ export declare class Cache implements Disposable {
343
426
  *
344
427
  * When `inFlight` is `'evict'`, always hard-deletes regardless of `invalidate` support — a new caller
345
428
  * must never join a read that started before this eviction (see {@link evictCaches}).
429
+ *
430
+ * A shared `key` left with nothing read before to serve or join is added to `cleared`, for the caller to record
431
+ * with the rest of its eviction; without `cleared`, it is recorded alone (see {@link recordSharedEvictions}).
346
432
  */
347
433
  private evictShared;
434
+ /**
435
+ * Records that the shared caches in `cleared` were just evicted whole for `repoPath`'s repository, leaving nothing
436
+ * read before to serve or join: each read from git alone, and each built from others only when all of them are
437
+ * recorded here too (see {@link sharedCacheSources}). With every one of {@link placementCacheKeys} among them, also
438
+ * records where each branch is checked out as evicted (see {@link evictBranchPlacement})
439
+ */
440
+ private recordSharedEvictions;
441
+ /**
442
+ * Whether `key`, and every cache it is built from, was evicted whole for `repoPath`'s repository after `observedAt`,
443
+ * with nothing read before left to serve or join: all they hold since was read after a change observed then
444
+ */
445
+ private isSharedEvictedSince;
348
446
  /**
349
447
  * Monotonic per-worktree counter, advanced whenever anything that can change `git status` output is
350
448
  * observed. `git status` and its siblings are point-in-time reads of mutable state, so deduplicating them
@@ -420,10 +518,11 @@ export declare class Cache implements Disposable {
420
518
  reset(): void;
421
519
  /**
422
520
  * Applies a watcher-observed change, sharing reads still in flight (see {@link applyRepositoryChanges}).
423
- * `options.movedWorktrees` is the event's `movedWorktrees`.
521
+ * `options.movedWorktrees` and `options.observedAt` are the event's `movedWorktrees` and `observedAt`.
424
522
  */
425
523
  onRepositoryChanged(repoPath: string, changes: Iterable<RepositoryChange>, options?: {
426
524
  movedWorktrees?: ReadonlySet<string>;
525
+ observedAt?: number;
427
526
  }): void;
428
527
  /**
429
528
  * Clears what `changes` can have made stale for `repoPath`, advances its status clock, and reconciles a
@@ -441,13 +540,23 @@ export declare class Cache implements Disposable {
441
540
  *
442
541
  * `options.movedWorktrees` names, by admin id (the `<id>` of `.git/worktrees/<id>`), the linked worktrees whose HEAD
443
542
  * moved, which are all that a `'worktreeHead'` among `changes` reports: each registered one is cleared as for its
444
- * own `'head'` change, and no other registered worktree with an admin id of its own is touched. Without it, any
445
- * linked worktree's HEAD may have moved, so each one but `repoPath` loses its current branch.
543
+ * own `'head'` change, and no other registered worktree with an admin id of its own is touched. Without it, or empty
544
+ * (no worktree known), any linked worktree's HEAD may have moved, so each one but `repoPath` loses its current branch.
545
+ *
546
+ * Unless `options.worktreeOnly`, a `'worktreeHead'`, announced or not, also drops which branch is checked out in which
547
+ * worktree for every worktree of the repository, unless `options.movedWorktrees` names no worktree but `repoPath`, or
548
+ * `options.observedAt` finds it already dropped since (see {@link evictBranchPlacement}).
549
+ *
550
+ * `options.observedAt` is the change ordinal (see `nextChangeOrdinal`) taken when the watcher observed the newest of
551
+ * `changes`. Each checkout of a repository reports a change to what they share, so the shared entries that an eviction
552
+ * after it already dropped whole, leaving nothing read before to serve or join, are kept: what they hold since was
553
+ * read after the change. Only those shared entries are kept; everything else is cleared as without it.
446
554
  */
447
555
  applyRepositoryChanges(repoPath: string, changes: Iterable<RepositoryChange>, inFlight: 'share' | 'evict', options?: {
448
556
  announced?: boolean;
449
557
  worktreeOnly?: boolean;
450
558
  movedWorktrees?: ReadonlySet<string>;
559
+ observedAt?: number;
451
560
  }): CachedGitTypes[];
452
561
  /**
453
562
  * Handles a watcher-observed `'gkConfig'` change. If a reconciler is registered (see {@link setGkConfigReconciler}),
@@ -655,7 +764,7 @@ export declare class Cache implements Disposable {
655
764
  private evictMergeTargetsOnCheckout;
656
765
  /** Clears the cached default branch for one `remote` key (the networked lookup or its `:local` variant). */
657
766
  deleteDefaultBranchName(repoPath: string, remote: string): void;
658
- getInitialCommitSha(repoPath: string, factory: (commonPath: string) => PromiseOrValue<string | undefined>): Promise<string | undefined>;
767
+ getInitialCommitSha(repoPath: string, factory: (commonPath: string, cacheable: CacheController, cancellation?: AbortSignal) => PromiseOrValue<string | undefined>, cancellation?: AbortSignal): Promise<string | undefined>;
659
768
  /** A rejected factory is never cached (`PromiseMap` evicts on rejection) — a failed read retries next time. */
660
769
  getEmptyTreeSha(repoPath: string, factory: (commonPath: string) => PromiseOrValue<string>): Promise<string>;
661
770
  getLastFetchedTimestamp(repoPath: string, factory: (commonPath: string) => PromiseOrValue<number | undefined>): Promise<number | undefined>;
@@ -668,9 +777,20 @@ export declare class Cache implements Disposable {
668
777
  cancellation?: AbortSignal;
669
778
  }): Promise<GitStash>;
670
779
  getTags(repoPath: string, factory: (commonPath: string, cacheable: CacheController, cancellation?: AbortSignal) => PromiseOrValue<PagedResult<GitTag>>, cancellation?: AbortSignal): Promise<PagedResult<GitTag>>;
780
+ /**
781
+ * The tag list shared by `repoPath`'s worktrees, as the common path holds it, without keeping a copy for
782
+ * `repoPath`. A caller maps the tags it needs with {@link GitTag.withRepoPath}; {@link getTags} keeps a mapped copy
783
+ * per worktree.
784
+ */
785
+ getSharedTags(repoPath: string, factory: (commonPath: string, cacheable: CacheController, cancellation?: AbortSignal) => PromiseOrValue<PagedResult<GitTag>>, cancellation?: AbortSignal): Promise<PagedResult<GitTag>>;
671
786
  getWorktrees(repoPath: string, factory: (commonPath: string, cacheable: CacheController, cancellation?: AbortSignal) => PromiseOrValue<GitWorktree[]>, options?: {
672
787
  force?: boolean;
673
788
  }, cancellation?: AbortSignal): Promise<GitWorktree[]>;
789
+ /**
790
+ * The entry shared by `repoPath`'s worktrees, as the common path holds it. A caller maps what it needs for
791
+ * `repoPath`; {@link getSharedOrCreate} keeps a mapped copy per worktree.
792
+ */
793
+ private getSharedEntry;
674
794
  private getSharedOrCreate;
675
795
  private getSharedOrCreateWithKey;
676
796
  private getSharedSimple;