@gitkraken/core-gitlens 0.10.6 → 0.11.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.
- package/CHANGELOG.md +33 -1
- package/dist/git/cache.d.ts +34 -2
- package/dist/git/cache.js +53 -7
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +1 -1
- package/dist/git/models/repository.d.ts +3 -2
- package/dist/git/models/repository.js +5 -4
- package/dist/git/models/repository.js.map +1 -1
- package/dist/git/providers/branches.d.ts +22 -0
- package/dist/git/providers/config.d.ts +3 -1
- package/dist/git/providers/diff.d.ts +1 -0
- package/dist/git/providers/provider.d.ts +13 -1
- package/dist/git/providers/staging.d.ts +1 -1
- package/dist/git/service.d.ts +17 -1
- package/dist/git/service.js +59 -8
- package/dist/git/service.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts +48 -5
- package/dist/git/watching/changeEvent.js +82 -7
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/classifyChange.d.ts +13 -2
- package/dist/git/watching/classifyChange.js +40 -5
- package/dist/git/watching/classifyChange.js.map +1 -1
- package/dist/git/watching/gitIgnoreFilter.d.ts +57 -10
- package/dist/git/watching/gitIgnoreFilter.js +186 -29
- package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
- package/dist/git/watching/initWatcher.d.ts +5 -1
- package/dist/git/watching/initWatcher.js +1 -1
- package/dist/git/watching/initWatcher.js.map +1 -1
- package/dist/git/watching/provider.d.ts +33 -8
- package/dist/git/watching/watchGroup.d.ts +13 -2
- package/dist/git/watching/watchGroup.js +60 -14
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +42 -1
- package/dist/git/watching/watchService.js +172 -20
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +50 -17
- package/dist/git/watching/watchSession.js +274 -83
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts +13 -2
- package/dist/git/watching/watcherPatterns.js +22 -2
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +121 -0
- package/dist/git/watching/worktreeSummary.js +427 -0
- package/dist/git/watching/worktreeSummary.js.map +1 -0
- package/dist/git-cli/cliGitProvider.d.ts +6 -1
- package/dist/git-cli/cliGitProvider.js +87 -2
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/git.js +1 -1
- package/dist/git-cli/providers/blame.js +1 -1
- package/dist/git-cli/providers/branches.d.ts +32 -1
- package/dist/git-cli/providers/branches.js +195 -0
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.js +1 -1
- package/dist/git-cli/providers/config.d.ts +3 -0
- package/dist/git-cli/providers/config.js +14 -8
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/contributors.js +1 -1
- package/dist/git-cli/providers/diff.d.ts +3 -0
- package/dist/git-cli/providers/diff.js +3 -2
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/graph.js +1 -1
- package/dist/git-cli/providers/maintenance.js +1 -1
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.js +1 -1
- package/dist/git-cli/providers/staging.js +2 -2
- package/dist/git-cli/providers/status.js +1 -1
- package/dist/git-cli/service.js +1 -0
- package/dist/git-cli/service.js.map +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/ipc/ipcServer.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/agents/providers/gkAgentProvider.js +2 -2
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/git-github/api/github.d.ts +1 -1
- package/dist/plus/git-github/api/github.js +2 -1
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/providers/github/blame.js +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +1 -1
- package/dist/plus/integrations/context.d.ts +1 -1
- package/dist/plus/integrations/integrationService.js +1 -1
- package/dist/plus/integrations/models/integration.d.ts +1 -1
- package/dist/plus/integrations/models/integration.js +2 -2
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +2 -0
- package/dist/plus/integrations/providers/jira.js +5 -0
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/linear.d.ts +7 -0
- package/dist/plus/integrations/providers/linear.js +19 -0
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/trello.d.ts +8 -0
- package/dist/plus/integrations/providers/trello.js +22 -0
- package/dist/plus/integrations/providers/trello.js.map +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +1 -1
- package/dist/plus/integrations/reads/currentAccount.js +1 -1
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +1 -0
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/dist/utils/event.d.ts +1 -1
- package/docs/integrations.md +6 -6
- package/docs/kepler-read-api-parity.md +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,36 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.11.0] - 2026-10-15
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Adds `maxWaitMs` to `RepositoryWatchSession.subscribe` and `subscribeToWorkingTree`, and `defaultRepoMaxWaitMs` / `defaultWorkingTreeMaxWaitMs` to `RepositoryWatchService`'s options: a flush happens no later than that long after the first pending change, however long activity continues. Across subscribers the shortest delay and the shortest max-wait win; `Infinity` opts a subscriber out of the cap (git)
|
|
14
|
+
- Adds which refs moved to `WatcherRepoChangeEvent`: `refs` holds the full ref names (or ref directories, or `HEAD`/`ORIG_HEAD`) whose files changed, and `mayHaveChangedRef(ref)` answers conservatively, treating a change with no name (a `packed-refs` rewrite, a `config` change, an injected change) as moving every ref of its kind. `RepositoryWatchSession.subscribe` takes `relevantRefs`, a list read at delivery, which narrows that subscription's events to changes that may move a listed ref, so a linked worktree's subscriber can skip sibling branches' commits; other subscribers and cache invalidation still see every change (git)
|
|
15
|
+
- Adds `branches.getAheadOfBase(branch)`: how far HEAD has moved past the base its branch was cut from, and which ref it was measured against. Bases are tried in trust order (the user's merge target, the detected one, the recorded `gk-merge-base`, then the local default branch), only recorded values count (never a reflog guess), and a target that no longer resolves falls through. Each is measured as itself or its tracking ref, whichever forked nearer HEAD, so a stale local `main` doesn't count commits `origin/main` already has. A base that is the branch itself, by name or as its copy on one of the repo's remotes, at HEAD's own commit answers no base rather than 0 ahead. It answers `{ base, dependsOn }`: `base` is the ref and count, `undefined` when there is no base (also on a detached HEAD or one with no commit yet), and `dependsOn` lists the refs whose movement can change the answer, given even without a base so a watcher learns when one appears. A count that can't be read rejects with git's error rather than answering no base (git, git-cli)
|
|
16
|
+
- Adds an exclude set to the file-watcher seam, so a native watcher can prune ignored directories before making any OS watch: `FileWatchingProvider.createWatcher` takes `options.excludes` (directories relative to the base path, each pruned with its subtree; globs or literal paths), and a provider that prunes natively sets `supportsExcludes`. Core always passes `**/node_modules` and `**/.git` for the working tree and the `.git` subtrees nothing reads (`objects`, `logs`, `hooks`, …) for `.git` watchers; for a `supportsExcludes` provider it adds the directories an ignore rule matches, read from git (new `GitProvider.getIgnoredDirectories`), and re-creates the working-tree watcher, new before old, when ignore rules change or an ignored directory appears after it started (a first build's `dist/`) (git, git-cli)
|
|
17
|
+
- Adds an `overflow` reason to `FileWatchEvent`, so a watcher that dropped events can make core resync: on the working tree it becomes an incomplete change (consumers refresh everything) and reloads the ignore rules, since a lost `.gitignore` edit would leave them stale; on a `.git` watcher every kind a watcher can report, which clears every cache type and refreshes every subscriber without unregistering the repository; and on `RepositoryInitWatcher` an `onDidCreate` for the overflowed path so the host rescans it for repositories. A reported directory now stands for everything beneath it, and `RepositoryWorkingTreeChangeEvent.changed(uri)` matches a file under a changed directory, since a native watcher can miss the files of a just-created directory (git)
|
|
18
|
+
- Adds `WorktreeSummaryService` (`GitService.summaries`, present when a `watchingProvider` is): a cached summary of each subscribed worktree (branch, detached, upstream, ahead/behind, dirty, and ahead-of-base from `getAheadOfBase`), kept current by the watch layer. An event re-reads only the fields it can affect (an edit runs only the dirty probe; an unrelated branch moving reads nothing), one read runs per worktree at a time, `onDidChange` / `onDidChangeSummary` fire only when a value changes, and a failed read keeps the last values marked `stale`; when only the base can't be read, the other fields still update. It watches only while subscribed (git)
|
|
19
|
+
- Adds `onDidChangeMergeTargets` (`GitService`, `GitProvider`, `Cache`): fires when an external `.git/gk/config` write changed a branch's merge-relevant keys (`gk-merge-base`, `gk-merge-target`, `gk-merge-target-user`, `gk-target-base`), naming those branches, once per repository (`repoPath` is its common path) and after the derived caches were cleared. It never fires for a rewrite that only touches activity timestamps, nor for core's own writes, including a branch delete's or rename's section rewrite; `refs` is `undefined` (any branch may have changed) for the coarse fallback (no reconciler, or a failed reconcile) or when there was no earlier snapshot to diff against (git, git-cli)
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Changes the watch debounce to flush during continuous activity: repository changes flush at least every 2 s and working-tree changes at least every 10 s by default, where a steady stream of events (a long rebase, a build writing into the working tree) used to defer every flush until it stopped. Recording an event no longer re-arms a timer or allocates an event object (git)
|
|
24
|
+
|
|
25
|
+
- Changes the `worktrees` repository change to mean only that the worktree list, or what `git worktree list` reports per worktree (its HEAD, lock or location), changed. A linked worktree's own index, paused-operation and HEAD writes reach only that worktree's session, through its own gitdir watcher, instead of waking every worktree sharing the repository as `worktrees`; a sibling's HEAD change still reaches the others as `worktrees`. A main checkout no longer receives each shared `.git` change twice once a linked worktree is watched (git)
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Fixes the watch layer's gitignore filter answering differently from git, which let ignored output reach subscribers as working-tree changes or, worse, dropped real changes: it now honours nested `.gitignore` files (deeper ones overriding, nothing re-included beneath an ignored directory), reads `info/exclude` from the common git dir for a linked worktree, applies `core.excludesFile` < `info/exclude` < `.gitignore` in that order rather than in whichever order the reads finished, resolves `core.excludesFile` as git does (a `~/` path expanded, and `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore` when unset), and matches case the way git does (`core.ignorecase`, else the platform default). An edited nested `.gitignore` reloads it, and a burst of edits costs one trailing reload rather than one per file. Where its matcher can't tell, it answers "not ignored", which costs a refresh rather than a missed change (git, git-cli)
|
|
30
|
+
- Fixes a standalone `createCliGitService` with a `watchingProvider` never re-reading the last-fetched time after a fetch: FETCH_HEAD reached only the per-watch `onFetchHeadChanged` hook. `RepositoryWatchService` now has a global `onDidChangeFetchHead` event, and the standalone service bridges it to the cache's `lastFetched` (git, git-cli)
|
|
31
|
+
- Fixes working-tree and repository change events advancing the wrong status clock when a host passed a path spelled differently from the cache's key (a Windows drive-letter case, backslashes or a trailing separator): `RepositoryWatchService.watch` and `getSession` key sessions by `getRepositoryKey`, so every session, event and hook carries the same key status reads fence on, and two spellings of one repository share a session (git)
|
|
32
|
+
|
|
33
|
+
## [0.10.7] - 2026-10-15
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Changes `getCurrentAccount` to answer for Jira Cloud, Linear and Trello, and resolves it before an issue tracker read so a host's current-account cache knows the viewer while mapping that read's issues; only Jira Data Center still refuses (plus/integrations)
|
|
38
|
+
|
|
9
39
|
## [0.10.6] - 2026-10-13
|
|
10
40
|
|
|
11
41
|
### Added
|
|
@@ -607,7 +637,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
607
637
|
|
|
608
638
|
- 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.
|
|
609
639
|
|
|
610
|
-
[unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.
|
|
640
|
+
[unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.11.0...HEAD
|
|
641
|
+
[0.11.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.10.7...gitkraken:releases/core/v0.11.0
|
|
642
|
+
[0.10.7]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.10.6...gitkraken:releases/core/v0.10.7
|
|
611
643
|
[0.10.6]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.10.5...gitkraken:releases/core/v0.10.6
|
|
612
644
|
[0.10.5]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.10.4...gitkraken:releases/core/v0.10.5
|
|
613
645
|
[0.10.4]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.10.3...gitkraken:releases/core/v0.10.4
|
package/dist/git/cache.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { PagedResult } from "../utils/paging.js";
|
|
2
1
|
import { PromiseOrValue } from "../utils/promise.js";
|
|
2
|
+
import { Event } from "../utils/event.js";
|
|
3
|
+
import { PagedResult } from "../utils/paging.js";
|
|
3
4
|
import { CacheController, PromiseCache, PromiseMap, RepoPromiseCacheMap } from "../utils/promiseCache.js";
|
|
4
5
|
import { ResourceUsage } from "../utils/resourceUsage.js";
|
|
5
6
|
import { Uri } from "../utils/uri.js";
|
|
@@ -39,6 +40,20 @@ export type CachedGitTypes = UriScopedCachedGitTypes | 'branch' | 'branches' | '
|
|
|
39
40
|
* the churn the key-aware reconcile replaced.
|
|
40
41
|
*/
|
|
41
42
|
export type GkReconcileOutcome = 'reconciled' | 'deferred' | 'failed';
|
|
43
|
+
/** Fired by {@link Cache.onDidChangeMergeTargets} */
|
|
44
|
+
export interface MergeTargetsChangeEvent {
|
|
45
|
+
/**
|
|
46
|
+
* The repository's common path (the main worktree's, once registered). Merge keys live in the shared
|
|
47
|
+
* `.git/gk/config`, so this fires once per change for the whole repository, not once per worktree.
|
|
48
|
+
*/
|
|
49
|
+
readonly repoPath: string;
|
|
50
|
+
/**
|
|
51
|
+
* Branches whose merge-relevant keys (`gk-merge-base`, `gk-merge-target`, `gk-merge-target-user`,
|
|
52
|
+
* `gk-target-base`) changed. `undefined` when it can't be told, so any branch's may have: the coarse fallback
|
|
53
|
+
* (no reconciler, or a failed reconcile), or a change with no earlier snapshot to diff against.
|
|
54
|
+
*/
|
|
55
|
+
readonly refs: ReadonlySet<string> | undefined;
|
|
56
|
+
}
|
|
42
57
|
export type ConflictDetectionCacheKey = `apply:${string}:${string}:${string}` | `merge:${string}:${string}` | `reapply:${string}:${string}`;
|
|
43
58
|
export declare function shouldEvictBlameCacheEntry(progressive: ProgressiveGitBlame | undefined): Promise<boolean>;
|
|
44
59
|
/**
|
|
@@ -64,6 +79,14 @@ export declare class Cache implements Disposable {
|
|
|
64
79
|
* `baseBranchName`/`branchOverviews` on every gk write. Absent means "never observed".
|
|
65
80
|
*/
|
|
66
81
|
private _gkConfigMergeSnapshots;
|
|
82
|
+
private readonly _onDidChangeMergeTargets;
|
|
83
|
+
/**
|
|
84
|
+
* Fires when an external `.git/gk/config` write changed a branch's merge-relevant keys — never for a write that
|
|
85
|
+
* only touched other keys (activity timestamps), and never for core's own writes, which
|
|
86
|
+
* {@link recordGkConfigWrite} folds into the snapshot before the watcher reports them. Fires after the derived
|
|
87
|
+
* caches were cleared, so a listener's re-read sees the new values.
|
|
88
|
+
*/
|
|
89
|
+
get onDidChangeMergeTargets(): Event<MergeTargetsChangeEvent>;
|
|
67
90
|
/**
|
|
68
91
|
* Reconciler registered by the CLI config sub-provider (see {@link setGkConfigReconciler}),
|
|
69
92
|
* invoked on a watcher-observed `'gkConfig'` change instead of the coarse `clearCaches(repoPath,
|
|
@@ -234,6 +257,8 @@ export declare class Cache implements Disposable {
|
|
|
234
257
|
* clear when no reconciler is registered (e.g. the GitHub provider) so nothing can go stale.
|
|
235
258
|
*/
|
|
236
259
|
private handleGkConfigChanged;
|
|
260
|
+
/** The coarse fallback: every derived merge cache is cleared, so any branch's merge targets may have changed */
|
|
261
|
+
private clearGkConfigCoarsely;
|
|
237
262
|
/** Hard-evicts the cached bulk `.git/gk/config` map so the next read hits disk. */
|
|
238
263
|
deleteGkConfigMap(repoPath: string): void;
|
|
239
264
|
/** The merge-relevant gk config snapshot currently serving as the reconcile baseline. */
|
|
@@ -276,6 +301,12 @@ export declare class Cache implements Disposable {
|
|
|
276
301
|
* the next real read (`getGkConfigMap`) populates one from scratch.
|
|
277
302
|
*/
|
|
278
303
|
recordGkConfigWrite(repoPath: string, key: string, value: string | undefined): void;
|
|
304
|
+
/**
|
|
305
|
+
* {@link recordGkConfigWrite} for a whole `branch.<ref>` section: our own `--remove-section` (a branch delete) or
|
|
306
|
+
* `--rename-section` (a branch rename, to `renamedTo`), so the reconcile that follows doesn't report it as an
|
|
307
|
+
* external merge-target change.
|
|
308
|
+
*/
|
|
309
|
+
recordGkConfigSectionWrite(repoPath: string, ref: string, renamedTo?: string): void;
|
|
279
310
|
/**
|
|
280
311
|
* Registers the reconciler invoked by {@link handleGkConfigChanged} on a watcher-observed
|
|
281
312
|
* `'gkConfig'` change. Only one reconciler is kept — later registrations replace earlier ones,
|
|
@@ -287,7 +318,8 @@ export declare class Cache implements Disposable {
|
|
|
287
318
|
* Diffs a freshly-read gk config map's merge-relevant subset against `priorSnapshot` (captured by
|
|
288
319
|
* `handleGkConfigChanged` before the reconcile started, so it reflects the pre-change state even
|
|
289
320
|
* though this call's own re-read already raced ahead and refreshed the live snapshot), cascading
|
|
290
|
-
* `baseBranchName`/`branchOverviews` for every ref whose merge-relevant key actually changed
|
|
321
|
+
* `baseBranchName`/`branchOverviews` for every ref whose merge-relevant key actually changed, then firing
|
|
322
|
+
* {@link onDidChangeMergeTargets} naming those refs.
|
|
291
323
|
* `priorSnapshot` of `undefined` (never observed before this reconcile) is treated as "everything
|
|
292
324
|
* may have changed" — a full coarse clear, same as the pre-existing watcher behavior. Returns
|
|
293
325
|
* whether anything changed (i.e. whether a follow-up repository-changed event is warranted).
|
package/dist/git/cache.js
CHANGED
|
@@ -2,6 +2,7 @@ import { exhaustiveArray } from "../utils/array.js";
|
|
|
2
2
|
import { raceWithSignal } from "../utils/cancellation.js";
|
|
3
3
|
import { debug } from "../utils/decorators/log.js";
|
|
4
4
|
import { invalidateMemoized } from "../utils/decorators/memoize.js";
|
|
5
|
+
import { Emitter } from "../utils/event.js";
|
|
5
6
|
import { getBranchId } from "../utils/gitRefs.js";
|
|
6
7
|
import { normalizePath } from "../utils/path.js";
|
|
7
8
|
import { PromiseCache, PromiseMap, RepoPromiseCacheMap } from "../utils/promiseCache.js";
|
|
@@ -133,6 +134,16 @@ var Cache = class Cache {
|
|
|
133
134
|
* `baseBranchName`/`branchOverviews` on every gk write. Absent means "never observed".
|
|
134
135
|
*/
|
|
135
136
|
_gkConfigMergeSnapshots = /* @__PURE__ */ new Map();
|
|
137
|
+
_onDidChangeMergeTargets = new Emitter();
|
|
138
|
+
/**
|
|
139
|
+
* Fires when an external `.git/gk/config` write changed a branch's merge-relevant keys — never for a write that
|
|
140
|
+
* only touched other keys (activity timestamps), and never for core's own writes, which
|
|
141
|
+
* {@link recordGkConfigWrite} folds into the snapshot before the watcher reports them. Fires after the derived
|
|
142
|
+
* caches were cleared, so a listener's re-read sees the new values.
|
|
143
|
+
*/
|
|
144
|
+
get onDidChangeMergeTargets() {
|
|
145
|
+
return this._onDidChangeMergeTargets.event;
|
|
146
|
+
}
|
|
136
147
|
/**
|
|
137
148
|
* Reconciler registered by the CLI config sub-provider (see {@link setGkConfigReconciler}),
|
|
138
149
|
* invoked on a watcher-observed `'gkConfig'` change instead of the coarse `clearCaches(repoPath,
|
|
@@ -145,6 +156,7 @@ var Cache = class Cache {
|
|
|
145
156
|
}
|
|
146
157
|
dispose() {
|
|
147
158
|
this.reset();
|
|
159
|
+
this._onDidChangeMergeTargets.dispose();
|
|
148
160
|
}
|
|
149
161
|
/** Resource usage retained by instantiated sub-caches and their bookkeeping maps. */
|
|
150
162
|
getResourceUsage() {
|
|
@@ -684,13 +696,21 @@ var Cache = class Cache {
|
|
|
684
696
|
const commonPath = this.getCommonPath(repoPath);
|
|
685
697
|
this._caches.gkConfigMap?.delete(commonPath);
|
|
686
698
|
if (this._gkConfigReconciler == null) {
|
|
687
|
-
this.
|
|
699
|
+
this.clearGkConfigCoarsely(repoPath);
|
|
688
700
|
return;
|
|
689
701
|
}
|
|
690
702
|
const priorSnapshot = this._gkConfigMergeSnapshots.get(commonPath);
|
|
691
703
|
Promise.resolve(this._gkConfigReconciler(repoPath, priorSnapshot)).then((outcome) => {
|
|
692
|
-
if (outcome === "failed") this.
|
|
693
|
-
}, () => this.
|
|
704
|
+
if (outcome === "failed") this.clearGkConfigCoarsely(repoPath);
|
|
705
|
+
}, () => this.clearGkConfigCoarsely(repoPath));
|
|
706
|
+
}
|
|
707
|
+
/** The coarse fallback: every derived merge cache is cleared, so any branch's merge targets may have changed */
|
|
708
|
+
clearGkConfigCoarsely(repoPath) {
|
|
709
|
+
this.clearCaches(repoPath, "gkConfig");
|
|
710
|
+
this._onDidChangeMergeTargets.fire({
|
|
711
|
+
repoPath: this.getCommonPath(repoPath),
|
|
712
|
+
refs: void 0
|
|
713
|
+
});
|
|
694
714
|
}
|
|
695
715
|
/** Hard-evicts the cached bulk `.git/gk/config` map so the next read hits disk. */
|
|
696
716
|
deleteGkConfigMap(repoPath) {
|
|
@@ -795,6 +815,21 @@ var Cache = class Cache {
|
|
|
795
815
|
this._gkConfigMergeSnapshots.set(commonPath, next);
|
|
796
816
|
}
|
|
797
817
|
/**
|
|
818
|
+
* {@link recordGkConfigWrite} for a whole `branch.<ref>` section: our own `--remove-section` (a branch delete) or
|
|
819
|
+
* `--rename-section` (a branch rename, to `renamedTo`), so the reconcile that follows doesn't report it as an
|
|
820
|
+
* external merge-target change.
|
|
821
|
+
*/
|
|
822
|
+
recordGkConfigSectionWrite(repoPath, ref, renamedTo) {
|
|
823
|
+
const commonPath = this.getCommonPath(repoPath);
|
|
824
|
+
const snapshot = this._gkConfigMergeSnapshots.get(commonPath);
|
|
825
|
+
if (snapshot == null) return;
|
|
826
|
+
const prefixLength = `branch.${ref}.`.length;
|
|
827
|
+
const next = /* @__PURE__ */ new Map();
|
|
828
|
+
for (const [key, value] of snapshot) if (branchOverviewGkConfigKeysRegex.exec(key)?.[1] !== ref) next.set(key, value);
|
|
829
|
+
else if (renamedTo != null) next.set(`branch.${renamedTo}.${key.substring(prefixLength)}`, value);
|
|
830
|
+
this._gkConfigMergeSnapshots.set(commonPath, next);
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
798
833
|
* Registers the reconciler invoked by {@link handleGkConfigChanged} on a watcher-observed
|
|
799
834
|
* `'gkConfig'` change. Only one reconciler is kept — later registrations replace earlier ones,
|
|
800
835
|
* which is harmless since every CLI config sub-provider sharing this `Cache` reconciles the same
|
|
@@ -807,7 +842,8 @@ var Cache = class Cache {
|
|
|
807
842
|
* Diffs a freshly-read gk config map's merge-relevant subset against `priorSnapshot` (captured by
|
|
808
843
|
* `handleGkConfigChanged` before the reconcile started, so it reflects the pre-change state even
|
|
809
844
|
* though this call's own re-read already raced ahead and refreshed the live snapshot), cascading
|
|
810
|
-
* `baseBranchName`/`branchOverviews` for every ref whose merge-relevant key actually changed
|
|
845
|
+
* `baseBranchName`/`branchOverviews` for every ref whose merge-relevant key actually changed, then firing
|
|
846
|
+
* {@link onDidChangeMergeTargets} naming those refs.
|
|
811
847
|
* `priorSnapshot` of `undefined` (never observed before this reconcile) is treated as "everything
|
|
812
848
|
* may have changed" — a full coarse clear, same as the pre-existing watcher behavior. Returns
|
|
813
849
|
* whether anything changed (i.e. whether a follow-up repository-changed event is warranted).
|
|
@@ -819,14 +855,24 @@ var Cache = class Cache {
|
|
|
819
855
|
if (priorSnapshot == null) {
|
|
820
856
|
this.evictShared("baseBranchName", repoPath);
|
|
821
857
|
this.evictShared("branchOverviews", repoPath);
|
|
858
|
+
this._onDidChangeMergeTargets.fire({
|
|
859
|
+
repoPath: commonPath,
|
|
860
|
+
refs: void 0
|
|
861
|
+
});
|
|
822
862
|
return true;
|
|
823
863
|
}
|
|
824
|
-
let
|
|
864
|
+
let refs;
|
|
825
865
|
for (const key of /* @__PURE__ */ new Set([...priorSnapshot.keys(), ...newSubset.keys()])) if (priorSnapshot.get(key) !== newSubset.get(key)) {
|
|
826
|
-
changed = true;
|
|
827
866
|
this.cascadeGkConfigKeyChange(commonPath, key);
|
|
867
|
+
const ref = branchOverviewGkConfigKeysRegex.exec(key)?.[1];
|
|
868
|
+
if (ref != null) (refs ??= /* @__PURE__ */ new Set()).add(ref);
|
|
828
869
|
}
|
|
829
|
-
return
|
|
870
|
+
if (refs == null) return false;
|
|
871
|
+
this._onDidChangeMergeTargets.fire({
|
|
872
|
+
repoPath: commonPath,
|
|
873
|
+
refs
|
|
874
|
+
});
|
|
875
|
+
return true;
|
|
830
876
|
}
|
|
831
877
|
/**
|
|
832
878
|
* Shared per-ref cascade for a changed `branch.<ref>.gk-...` key: invalidates `baseBranchName` (for
|