@gitkraken/core-gitlens 0.48.0 → 0.49.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 +20 -1
- package/dist/git/cache.d.ts +4 -0
- package/dist/git/cache.js +12 -0
- package/dist/git/cache.js.map +1 -1
- package/dist/git/providers/config.d.ts +3 -2
- package/dist/git-cli/cliGitProvider.d.ts +2 -0
- package/dist/git-cli/cliGitProvider.js +6 -0
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +10 -6
- package/dist/git-cli/providers/config.js +46 -11
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/utils/keys/keymapDispatcher.js +8 -0
- package/dist/utils/keys/keymapDispatcher.js.map +1 -1
- package/package.json +1 -1
|
@@ -100,8 +100,9 @@ export interface GitConfigSubProvider {
|
|
|
100
100
|
getCurrentUser(repoPath: string): Promise<GitUser | undefined>;
|
|
101
101
|
getDefaultWorktreePath?(repoPath: string): Promise<string | undefined>;
|
|
102
102
|
/**
|
|
103
|
-
* Rejects, keeping nothing, when git gives no answer (it ran past its time limit, was killed or couldn't start),
|
|
104
|
-
* a later call reads again. Git saying `repoPath` isn't a
|
|
103
|
+
* Rejects, keeping nothing, when git gives no answer (it ran past its time limit, was killed or couldn't start), or
|
|
104
|
+
* when `repoPath` is closed while its git dir is read, so a later call reads again. Git saying `repoPath` isn't a
|
|
105
|
+
* repository it can use still answers `<repoPath>/.git`.
|
|
105
106
|
*/
|
|
106
107
|
getGitDir?(repoPath: string): Promise<GitDir | undefined>;
|
|
107
108
|
/**
|
|
@@ -110,6 +110,8 @@ export declare class CliGitProvider implements GitProvider {
|
|
|
110
110
|
/** By common git dir, the folders whose worktrees are ignored there: a common git dir never moves while it is open */
|
|
111
111
|
private readonly _ignoredWorktreeRoots;
|
|
112
112
|
private readonly _indexRefresher;
|
|
113
|
+
private readonly _unregisterListener;
|
|
114
|
+
private readonly _resetListener;
|
|
113
115
|
constructor(options: CliGitProviderOptions);
|
|
114
116
|
/** The underlying cache instance (for repo path registration, etc.) */
|
|
115
117
|
get cache(): Cache;
|
|
@@ -78,6 +78,8 @@ var CliGitProvider = class {
|
|
|
78
78
|
/** By common git dir, the folders whose worktrees are ignored there: a common git dir never moves while it is open */
|
|
79
79
|
_ignoredWorktreeRoots = /* @__PURE__ */ new Map();
|
|
80
80
|
_indexRefresher;
|
|
81
|
+
_unregisterListener;
|
|
82
|
+
_resetListener;
|
|
81
83
|
constructor(options) {
|
|
82
84
|
const hostHooks = options.context.hooks;
|
|
83
85
|
this._hostHooks = hostHooks;
|
|
@@ -119,6 +121,8 @@ var CliGitProvider = class {
|
|
|
119
121
|
this._git.bindChangeNotifier((repoPaths, changes, sharedPaths, named) => this.notifyChangedCore(repoPaths, changes, void 0, sharedPaths, named));
|
|
120
122
|
this._git.bindHeadReader((path) => readHeadState(path, this.context.fs, this._cache));
|
|
121
123
|
this._git.bindIgnoredWorktreeRootsReader((path) => this.getIgnoredWorktreeRoots(path));
|
|
124
|
+
this._unregisterListener = this._cache.onDidUnregisterRepoPath((repoPath) => this._git.clearPendingCommands([repoPath]));
|
|
125
|
+
this._resetListener = this._cache.onDidReset(() => this._git.clearPendingCommands());
|
|
122
126
|
}
|
|
123
127
|
/** The underlying cache instance (for repo path registration, etc.) */
|
|
124
128
|
get cache() {
|
|
@@ -806,6 +810,8 @@ var CliGitProvider = class {
|
|
|
806
810
|
}
|
|
807
811
|
}
|
|
808
812
|
dispose() {
|
|
813
|
+
this._unregisterListener.dispose();
|
|
814
|
+
this._resetListener.dispose();
|
|
809
815
|
this._onDidAnnounceChanges.dispose();
|
|
810
816
|
this._indexRefresher.dispose();
|
|
811
817
|
this._git.dispose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cliGitProvider.js","names":["fs"],"sources":["../../../git-cli/src/cliGitProvider.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport { homedir } from 'node:os';\nimport * as path from 'node:path';\nimport { env } from 'node:process';\nimport type { CachedGitTypes, MergeTargetsChangeEvent } from '@gitlens/git/cache.js';\nimport { Cache, resetDropsPendingRuns } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport type { GitFileStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { RepositoryChange } from '@gitlens/git/models/repository.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitOperationRunOptions } from '@gitlens/git/providers/operations.js';\nimport type {\n\tAnnouncedRepositoryChanges,\n\tGitProvider,\n\tGitProviderDescriptor,\n} from '@gitlens/git/providers/provider.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { parseGitRemoteUrl } from '@gitlens/git/utils/remote.utils.js';\nimport { isUncommitted } from '@gitlens/git/utils/revision.utils.js';\nimport { getRefChangeKind } from '@gitlens/git/watching/changeEvent.js';\nimport { GitIgnoreFilter } from '@gitlens/git/watching/gitIgnoreFilter.js';\nimport { sanitizeIgnoredWorktreeFolders } from '@gitlens/git/watching/watcherPatterns.js';\nimport { isCancellationError } from '@gitlens/utils/cancellation.js';\nimport type { Event } from '@gitlens/utils/event.js';\nimport { Emitter } from '@gitlens/utils/event.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { joinPaths, maybeUri, normalizePath, splitPath, trimTrailingSlashes } from '@gitlens/utils/path.js';\nimport { cancellable } from '@gitlens/utils/promise.js';\nimport { iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { fileUri, joinUriPath, parseUri, toFsPath } from '@gitlens/utils/uri.js';\nimport { worktreeSharedChanges } from './exec/commandClassifier.js';\nimport { fsExists } from './exec/exec.js';\nimport type { FilteredGitFeatures, GitFeatureOrPrefix, GitFeatures } from './exec/features.js';\nimport type { GitFeatureUnsupportedMessage, GitOptions, NamedRefs } from './exec/git.js';\nimport { batchLiteralPathspecs, Git, gitConfigsStatus, GitError, GitErrors } from './exec/git.js';\nimport { readCommonGitDir, readHeadState } from './exec/headState.js';\nimport type { IndexRefresherOptions } from './exec/indexRefresh.js';\nimport { IndexRefresher } from './exec/indexRefresh.js';\nimport type { GitLocation } from './exec/locator.js';\nimport { foldMatchingIgnored } from './parsers/statusParser.js';\nimport { BlameGitSubProvider } from './providers/blame.js';\nimport { BranchesGitSubProvider } from './providers/branches.js';\nimport { CommitsGitSubProvider } from './providers/commits.js';\nimport { ConfigGitSubProvider, isGitBooleanFalse, parseGitBoolean } from './providers/config.js';\nimport { ContributorsGitSubProvider } from './providers/contributors.js';\nimport { DiffGitSubProvider } from './providers/diff.js';\nimport { GraphGitSubProvider } from './providers/graph.js';\nimport { MaintenanceGitSubProvider } from './providers/maintenance.js';\nimport { OperationsGitSubProvider } from './providers/operations.js';\nimport { PatchGitSubProvider } from './providers/patch.js';\nimport { PausedOperationsGitSubProvider } from './providers/pausedOperations.js';\nimport { RefsGitSubProvider } from './providers/refs.js';\nimport { RemotesGitSubProvider } from './providers/remotes.js';\nimport { RevisionGitSubProvider } from './providers/revision.js';\nimport { StagingGitSubProvider } from './providers/staging.js';\nimport { StashGitSubProvider } from './providers/stash.js';\nimport { StatusGitSubProvider } from './providers/status.js';\nimport { TagsGitSubProvider } from './providers/tags.js';\nimport { WorktreesGitSubProvider } from './providers/worktrees.js';\n\n/** How long reading the folders whose worktrees are ignored may take before it counts as failed (a hung mount) */\nconst ignoredWorktreeRootsTimeoutMs = 5000;\n\nexport interface CliGitProviderOptions {\n\t/** Use an existing Cache instance, or one will be created */\n\tcache?: Cache;\n\t/** Context providing config and event bus hooks */\n\tcontext: GitServiceContext;\n\t/** Function that resolves the git binary location (path + version) */\n\tlocator: () => Promise<GitLocation>;\n\t/** Pre-built Git executor — when provided, used instead of creating a new Git from locator/options */\n\tgit?: Git;\n\t/** Git execution options (timeout, trust, queue config, hooks, etc.) */\n\tgitOptions?: GitOptions;\n\t/**\n\t * Whether repositories reached through this provider are on the LOCAL filesystem. `false` disables the\n\t * maintenance sub-provider entirely (Live Share): its probes stat local paths, and its writes are\n\t * rejected by the host's command allowlist, so inheriting it yields empty reports and swallowed\n\t * failures rather than an honest \"unsupported here\". Defaults to `true`.\n\t */\n\tlocalRepositories?: boolean;\n\t/**\n\t * Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist: they are left out\n\t * of worktree lists, and their add, remove, lock, unlock or move run through `notify: 'infer'`, and the watcher's\n\t * reports of their admin entries, raise no `worktrees` change. The typed worktree writes still announce one. A host\n\t * registers one for a tool's throwaway worktrees, which no host shows (sync-tools' `sync-tools-worktrees`, for one).\n\t * Nothing else is ignored, since a user may keep real worktrees anywhere, the git dir included. A folder that isn't\n\t * a literal path strictly inside the common git dir, or that lies under `worktrees`, is dropped.\n\t */\n\tignoredWorktreeFolders?: readonly string[];\n\t/**\n\t * Refreshes a checkout's index in the background after core's own clone, worktree add, checkout, restore, merge, pull,\n\t * reset, cherry-pick, revert, rebase, stash apply, pop and push, and abort or continue of a paused operation rewrote\n\t * it, so later status and diff reads stop re-hashing the files written in the index's second. A write that stops on\n\t * conflicts refreshes too, since the files it rewrote first are read the most while the conflicts are resolved. Off\n\t * by default: each costs a status of the whole checkout, worth it only where that checkout will be read again.\n\t * `scheduleIndexRefresh` runs either way.\n\t */\n\trefreshIndexAfterWrites?: boolean;\n\t/** The clock and timer behind the background index refresh, for tests; the real ones by default */\n\tindexRefresh?: Pick<IndexRefresherOptions, 'now' | 'setTimer'>;\n}\n\n/**\n * Exposes `isTrackedWithDetails` as a callable method for sub-providers.\n * The class declares it as a regular method, but TypeScript's structural\n * typing makes it inaccessible through the class type alone when consumed\n * internally — this type re-maps it to ensure sub-providers can call it.\n */\nexport type CliGitProviderInternal = Omit<CliGitProvider, 'isTrackedWithDetails'> & {\n\tisTrackedWithDetails: CliGitProvider['isTrackedWithDetails'];\n};\n\n/**\n * A fully-wired CLI-based git provider that executes git commands via `child_process`.\n * Implements both `CliGitProviderInternal` (for internal sub-provider wiring)\n * and `GitProvider` (for registration in a provider registry).\n *\n * @example\n * ```typescript\n * const provider = new CliGitProvider({\n * context: { events: myEvents },\n * locator: () => findGitPath(null),\n * gitOptions: { gitTimeout: 30000 },\n * });\n *\n * const branches = await provider.branches.getBranches(repoPath);\n * const status = await provider.status.getStatus(repoPath);\n * ```\n */\nexport class CliGitProvider implements GitProvider {\n\treadonly descriptor: GitProviderDescriptor = { id: 'git', name: 'Git', virtual: false };\n\n\tprivate readonly _cache: Cache;\n\tprivate readonly _cacheOwned: boolean;\n\tprivate readonly _git: Git;\n\n\treadonly context: GitServiceContext;\n\t/** The host's own hooks, before the provider wraps `cache.onReset` with its own clearing */\n\tprivate readonly _hostHooks: GitServiceContext['hooks'];\n\tprivate readonly _localRepositories: boolean;\n\tprivate readonly _ignoredWorktreeFolders: readonly string[];\n\t/** By common git dir, the folders whose worktrees are ignored there: a common git dir never moves while it is open */\n\tprivate readonly _ignoredWorktreeRoots = new Map<string, Promise<readonly string[]>>();\n\tprivate readonly _indexRefresher: IndexRefresher;\n\n\tconstructor(options: CliGitProviderOptions) {\n\t\t// Every typed write announces itself through `onReset`, so the provider clears its own state there\n\t\t// rather than trusting each host to: a host with no handler still reads fresh after a write. A write\n\t\t// hard-evicts, so a caller after it never joins a read that started before it; watcher-driven clears\n\t\t// reach `Cache.clearCaches` directly and keep sharing in-flight reads.\n\t\tconst hostHooks = options.context.hooks;\n\t\tthis._hostHooks = hostHooks;\n\t\tthis.context = {\n\t\t\t...options.context,\n\t\t\thooks: {\n\t\t\t\t...hostHooks,\n\t\t\t\tcache: {\n\t\t\t\t\t...hostHooks?.cache,\n\t\t\t\t\tonReset: (repoPath, ...types) => {\n\t\t\t\t\t\tthis._cache.evictCaches(repoPath, ...types);\n\t\t\t\t\t\tif (resetDropsPendingRuns(types)) {\n\t\t\t\t\t\t\tthis._git.clearPendingCommands(this.getRepositoryPaths(repoPath));\n\t\t\t\t\t\t}\n\t\t\t\t\t\thostHooks?.cache?.onReset?.(repoPath, ...types);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trepository: {\n\t\t\t\t\t...hostHooks?.repository,\n\t\t\t\t\tonChanged: (repoPath, changes, refs, options) =>\n\t\t\t\t\t\tthis.announceWrite(repoPath, changes, refs, {\n\t\t\t\t\t\t\tconfigConfinedToRefs: options?.configConfinedToRefs,\n\t\t\t\t\t\t\tmovedWorktrees: this.getMovedWorktrees([repoPath], changes),\n\t\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t\tthis._localRepositories = options.localRepositories ?? true;\n\t\tthis._ignoredWorktreeFolders = sanitizeIgnoredWorktreeFolders(options.ignoredWorktreeFolders);\n\t\tthis._git =\n\t\t\toptions.git ??\n\t\t\tnew Git(options.locator, {\n\t\t\t\t...options.gitOptions,\n\t\t\t\t// The workspace flag, when the context has one, answers for every path; otherwise the host's own\n\t\t\t\t// per-path predicate (`gitOptions.isTrusted`) stands, so a multi-repository host can refuse one repository\n\t\t\t\tisTrusted:\n\t\t\t\t\toptions.context.workspace?.isTrusted != null\n\t\t\t\t\t\t? () => options.context.workspace!.isTrusted!\n\t\t\t\t\t\t: options.gitOptions?.isTrusted,\n\t\t\t});\n\t\tthis._cacheOwned = !(options.cache instanceof Cache);\n\t\tthis._cache = options.cache instanceof Cache ? options.cache : new Cache();\n\t\tthis._indexRefresher = new IndexRefresher({\n\t\t\t...options.indexRefresh,\n\t\t\tafterWrites: options.refreshIndexAfterWrites,\n\t\t\tgit: this._git,\n\t\t\tstatIndexMtimeMs: checkoutPath => this.statIndexMtimeMs(checkoutPath),\n\t\t});\n\n\t\t// Wires a raw `git.run({ notify })` call back to this provider's own cache/host announcement —\n\t\t// unconditionally, so a host-supplied `options.git` gets bound exactly like one we construct here.\n\t\tthis._git.bindChangeNotifier((repoPaths, changes, sharedPaths, named) =>\n\t\t\tthis.notifyChangedCore(repoPaths, changes, undefined, sharedPaths, named),\n\t\t);\n\t\tthis._git.bindHeadReader(path => readHeadState(path, this.context.fs, this._cache));\n\t\t// Bound even with no folder registered, so a `Git` shared with another provider never keeps that one's folders\n\t\tthis._git.bindIgnoredWorktreeRootsReader(path => this.getIgnoredWorktreeRoots(path));\n\t}\n\n\t/** The underlying cache instance (for repo path registration, etc.) */\n\tget cache(): Cache {\n\t\treturn this._cache;\n\t}\n\n\t/** The per-checkout queue that refreshes an index a write left with untrusted entries */\n\tget indexRefresher(): IndexRefresher {\n\t\treturn this._indexRefresher;\n\t}\n\n\tprivate async statIndexMtimeMs(checkoutPath: string): Promise<number | undefined> {\n\t\ttry {\n\t\t\tlet gitDir = this._cache.gitDir.get(checkoutPath);\n\t\t\tif (gitDir == null) {\n\t\t\t\t// A failed clone or worktree add leaves no checkout, and resolving one there anyway would cache, for its\n\t\t\t\t// path, the git dir of whatever repository git falls back to\n\t\t\t\tif (!(await fsExists(path.join(checkoutPath, '.git')))) return undefined;\n\n\t\t\t\tgitDir = await this.config.getGitDir(checkoutPath);\n\t\t\t}\n\t\t\treturn (await fs.stat(path.join(gitDir.uri.fsPath, 'index'))).mtimeMs;\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tget onDidChangeMergeTargets(): Event<MergeTargetsChangeEvent> {\n\t\treturn this._cache.onDidChangeMergeTargets;\n\t}\n\n\tgetIgnoredWorktreeFolders(_repoPath: string): readonly string[] {\n\t\treturn this._ignoredWorktreeFolders;\n\t}\n\n\t/**\n\t * `[]`, reading nothing, when no folder is registered. Read once per common git dir, since a worktree list rebuild\n\t * and every inferred worktree write ask for them; a read that fails or doesn't settle in time (a hung mount) rejects,\n\t * and isn't kept, so the next call reads again\n\t */\n\tasync getIgnoredWorktreeRoots(repoPath: string): Promise<readonly string[]> {\n\t\tif (!this._ignoredWorktreeFolders.length) return [];\n\n\t\tconst commonGitDir = await cancellable(this.findCommonGitDir(repoPath), ignoredWorktreeRootsTimeoutMs);\n\t\tlet roots = this._ignoredWorktreeRoots.get(commonGitDir);\n\t\tif (roots == null) {\n\t\t\tconst read = cancellable(this.readIgnoredWorktreeRoots(commonGitDir), ignoredWorktreeRootsTimeoutMs);\n\t\t\tconst entry = read.then(r => r.roots);\n\t\t\troots = entry;\n\t\t\tthis._ignoredWorktreeRoots.set(commonGitDir, entry);\n\t\t\tconst forget = () => {\n\t\t\t\tif (this._ignoredWorktreeRoots.get(commonGitDir) === entry) {\n\t\t\t\t\tthis._ignoredWorktreeRoots.delete(commonGitDir);\n\t\t\t\t}\n\t\t\t};\n\t\t\t// Roots missing the resolved spelling still serve this call, but a later one resolves again\n\t\t\tvoid read.then(r => (r.resolved ? undefined : forget()), forget);\n\t\t}\n\t\treturn roots;\n\t}\n\n\t/**\n\t * From the cached git dir, or the repository's own files, without running git; a repository whose files don't\n\t * show it (a bare one) runs git once, and the git dir it finds is cached with the repository\n\t */\n\tprivate async findCommonGitDir(repoPath: string): Promise<string> {\n\t\tconst commonGitDir = await readCommonGitDir(repoPath, this.context.fs, this._cache);\n\t\tif (commonGitDir != null) return commonGitDir;\n\n\t\tconst gitDir = await this.config.getGitDir(repoPath);\n\t\treturn (gitDir.commonUri ?? gitDir.uri).fsPath;\n\t}\n\n\t/** `resolved` is false when the common git dir's resolved spelling couldn't be read */\n\tprivate async readIgnoredWorktreeRoots(\n\t\tcommonGitDir: string,\n\t): Promise<{ readonly roots: readonly string[]; readonly resolved: boolean }> {\n\t\tconst roots = new Set(this._ignoredWorktreeFolders.map(f => normalizePath(joinPaths(commonGitDir, f))));\n\t\tif (!this._localRepositories) return { roots: [...roots], resolved: true };\n\n\t\t// Only the common git dir is resolved: a folder doesn't exist until its tool first makes a worktree there\n\t\tconst realCommonGitDir = await fs.realpath(commonGitDir).catch(() => undefined);\n\t\tif (realCommonGitDir == null) return { roots: [...roots], resolved: false };\n\n\t\tfor (const folder of this._ignoredWorktreeFolders) {\n\t\t\troots.add(normalizePath(joinPaths(realCommonGitDir, folder)));\n\t\t}\n\t\treturn { roots: [...roots], resolved: true };\n\t}\n\n\tensureRegistered(repoPath: string): Promise<void> | undefined {\n\t\treturn this._cache.ensureRegistered(repoPath);\n\t}\n\n\tgetCommonPath(repoPath: string): string | undefined {\n\t\t// An unregistered path is its own common path in the cache, which would hide a sibling worktree's writes\n\t\treturn this._cache.isRegistered(repoPath) ? this._cache.getCommonPath(repoPath) : undefined;\n\t}\n\n\tprivate readonly _onDidAnnounceChanges = new Emitter<AnnouncedRepositoryChanges>();\n\tget onDidAnnounceChanges(): Event<AnnouncedRepositoryChanges> {\n\t\treturn this._onDidAnnounceChanges.event;\n\t}\n\n\t/** The underlying git execution instance (for sub-providers that need direct exec/stream access) */\n\tget git(): Git {\n\t\treturn this._git;\n\t}\n\n\t/** Returns whether the installed git version supports the given feature. */\n\tsupports(feature: GitFeatures): boolean | Promise<boolean> {\n\t\treturn this._git.supports(feature);\n\t}\n\n\t/** Returns all features matching the prefix that the installed git version supports. */\n\tsupported<T extends GitFeatureOrPrefix>(feature: T): FilteredGitFeatures<T>[] | Promise<FilteredGitFeatures<T>[]> {\n\t\treturn this._git.supported(feature);\n\t}\n\n\t/** Throws if the installed git version does not support the given feature. */\n\tasync ensureSupports(feature: GitFeatures, prefix: string, suffix: string): Promise<void>;\n\tasync ensureSupports(feature: GitFeatures, message: GitFeatureUnsupportedMessage): Promise<void>;\n\tasync ensureSupports(\n\t\tfeature: GitFeatures,\n\t\tprefixOrMessage: string | GitFeatureUnsupportedMessage,\n\t\tsuffix?: string,\n\t): Promise<void> {\n\t\treturn typeof prefixOrMessage === 'function'\n\t\t\t? this._git.ensureSupports(feature, prefixOrMessage)\n\t\t\t: this._git.ensureSupports(feature, prefixOrMessage, suffix!);\n\t}\n\n\t/** Returns the installed git version string. */\n\tasync version(): Promise<string> {\n\t\treturn this._git.version();\n\t}\n\n\t/** Returns the resolved git binary path. */\n\tasync path(): Promise<string> {\n\t\treturn this._git.path();\n\t}\n\n\tasync clone(\n\t\turl: string,\n\t\tparentPath: string,\n\t\toptions?: { folderName?: string },\n\t\trunOptions?: GitOperationRunOptions,\n\t): Promise<string | undefined> {\n\t\tlet folderPath: string;\n\t\tif (options?.folderName) {\n\t\t\tfolderPath = joinPaths(parentPath, options.folderName);\n\t\t} else {\n\t\t\tconst [, , remotePath] = parseGitRemoteUrl(url);\n\t\t\tconst remoteName = remotePath.split('/').pop();\n\t\t\tif (!remoteName) return undefined;\n\n\t\t\tlet count = 0;\n\t\t\tfolderPath = joinPaths(parentPath, remoteName);\n\t\t\twhile ((await fsExists(folderPath)) && count < 20) {\n\t\t\t\tcount++;\n\t\t\t\tfolderPath = joinPaths(parentPath, `${remoteName}-${count}`);\n\t\t\t}\n\t\t}\n\n\t\t// `throw`: the default handler swallows `remoteConnectionError`, which would return a folder never cloned\n\t\tawait this._indexRefresher.refreshAfter(folderPath, () =>\n\t\t\tthis._git.run({ cwd: parentPath, errors: 'throw', ...runOptions }, 'clone', url, folderPath),\n\t\t);\n\n\t\treturn folderPath;\n\t}\n\n\t/** Creates a new repository at `targetPath` (`git init`), creating it first if it doesn't yet exist. */\n\tasync init(targetPath: string, options?: { defaultBranch?: string; bare?: boolean }): Promise<void> {\n\t\tawait fs.mkdir(targetPath, { recursive: true });\n\n\t\tconst args = ['init'];\n\t\tif (options?.defaultBranch) {\n\t\t\targs.push('-b', options.defaultBranch);\n\t\t}\n\t\tif (options?.bare) {\n\t\t\targs.push('--bare');\n\t\t}\n\n\t\t// Run inside the target rather than naming it from its parent: a relative `targetPath` would otherwise\n\t\t// be resolved against the parent a second time\n\t\tawait this._git.run({ cwd: targetPath }, ...args);\n\t}\n\n\t/**\n\t * Notifies the provider that `repoPath` was mutated outside of a typed sub-provider method — e.g. a\n\t * consumer that ran a command through the raw `git.run`/`provider.git.run` escape hatch. Fires the same\n\t * `cache.onReset`/`repository.onChanged` hooks a typed mutator would, so, exactly as after a typed write,\n\t * the provider hard-evicts its own caches for `repoPath` and drops its pending commands for the repository\n\t * (its sibling worktrees included) before the host's handlers run.\n\t *\n\t * What is reset: `options.cache` when given (`'all'` for everything, `[]` for nothing); otherwise the\n\t * cache types `changes` map to, the same mapping a file watcher's changes get, status clock included.\n\t * An empty `changes`, or one naming `'unknown'` or `'closed'`, resets everything. Changes that map to\n\t * no cache type (e.g. `'starred'`) reset nothing, and `onReset` doesn't fire; `onChanged` always fires.\n\t */\n\tnotifyChanged(\n\t\trepoPath: string,\n\t\tchanges: readonly RepositoryChange[],\n\t\toptions?: { cache?: readonly CachedGitTypes[] | 'all' },\n\t): void {\n\t\tthis.notifyChangedCore([repoPath], changes, options);\n\t}\n\n\t/**\n\t * {@link notifyChanged} for one change seen from several paths, e.g. a `-C` shared-state verb announced\n\t * for both its target and the caller's `cwd`. Each path's caches are reset and the host's `onReset` fires\n\t * for each, since a host may keep per-worktree state, but a repository's pending commands are dropped once\n\t * however many of its worktrees are named.\n\t *\n\t * Each path hears the announcement once: `repoPaths` hear all of `changes`, `sharedPaths` (reset and\n\t * `onReset`-ed like `repoPaths`) and then the other registered worktrees sharing a repository with any of\n\t * them (reset like a typed write's, with no `onReset`) hear the shared part of it, see\n\t * {@link getSiblingChanges}. `names.refs` reach `repoPaths` whole and the others as {@link getSharedRefs}.\n\t */\n\tprivate notifyChangedCore(\n\t\trepoPaths: readonly string[],\n\t\tchanges: readonly RepositoryChange[],\n\t\toptions?: { cache?: readonly CachedGitTypes[] | 'all' },\n\t\tsharedPaths?: readonly string[],\n\t\tnames?: NamedRefs,\n\t): void {\n\t\tconst announcements = new Map<string, readonly RepositoryChange[]>();\n\t\tfor (const repoPath of repoPaths) {\n\t\t\tannouncements.set(repoPath, [...changes]);\n\t\t}\n\t\tconst shared = sharedPaths?.length ? this.getSharedChanges(changes) : undefined;\n\t\tif (shared != null) {\n\t\t\tfor (const path of sharedPaths!) {\n\t\t\t\tif (!announcements.has(path)) {\n\t\t\t\t\tannouncements.set(path, shared);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst resets: { repoPath: string; types: CachedGitTypes[] }[] = [];\n\t\tconst pendingPaths = new Set<string>();\n\t\tfor (const [repoPath, announced] of announcements) {\n\t\t\tconst types = this.resetForChanges(\n\t\t\t\trepoPath,\n\t\t\t\tannounced,\n\t\t\t\toptions?.cache,\n\t\t\t\trepoPaths.includes(repoPath) ? 'all' : 'shared',\n\t\t\t);\n\t\t\tif (types == null) {\n\t\t\t\t// A gk config change is reconciled outside the cache types, but its re-read must not join a pre-write run\n\t\t\t\tif (options?.cache == null && announced.includes('gkConfig')) {\n\t\t\t\t\tfor (const path of this.getRepositoryPaths(repoPath)) {\n\t\t\t\t\t\tpendingPaths.add(path);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tresets.push({ repoPath: repoPath, types: types });\n\t\t\tif (resetDropsPendingRuns(types)) {\n\t\t\t\tfor (const path of this.getRepositoryPaths(repoPath)) {\n\t\t\t\t\tpendingPaths.add(path);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// The worktrees no one named: their shared refs, tags, stash, remotes and config just changed too\n\t\tconst named = [...announcements.keys()];\n\t\tfor (const repoPath of named) {\n\t\t\tfor (const [path, siblingChanges] of this.getSiblingChanges(repoPath, changes)) {\n\t\t\t\tif (announcements.has(path)) continue;\n\n\t\t\t\tannouncements.set(path, siblingChanges);\n\t\t\t\tthis.resetForChanges(path, siblingChanges, options?.cache, 'sibling');\n\t\t\t}\n\t\t}\n\n\t\tif (pendingPaths.size) {\n\t\t\tthis._git.clearPendingCommands([...pendingPaths]);\n\t\t}\n\t\tfor (const { repoPath, types } of resets) {\n\t\t\tthis._hostHooks?.cache?.onReset?.(repoPath, ...types);\n\t\t}\n\t\t// The host's own hook: `context.hooks.repository.onChanged` also fans out to siblings, which would\n\t\t// announce a path a second time\n\t\tconst sharedRefs = names?.refs.length ? getSharedRefs(changes, names.refs) : undefined;\n\t\tconst movedWorktrees = this.getMovedWorktrees(repoPaths, changes);\n\t\tfor (const [path, announced] of announcements) {\n\t\t\tthis.announceChanged(path, [...announced], repoPaths.includes(path) ? names?.refs : sharedRefs, {\n\t\t\t\tconfigConfinedToRefs: names?.configConfinedToRefs,\n\t\t\t\tmovedWorktrees: movedWorktrees,\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Announces a typed write that ran in `repoPath`, as `context.hooks.repository.onChanged` does, for a write that\n\t * knows which linked worktrees' HEADs it moved (see `AnnouncedRepositoryChanges.movedWorktrees`) where `repoPath`\n\t * doesn't say: a worktree added or removed from it. `options.configConfinedToRefs` is as for the hook.\n\t *\n\t * @internal not intended to be used outside of the sub-providers\n\t */\n\tannounceWrite(\n\t\trepoPath: string,\n\t\tchanges: RepositoryChange[],\n\t\trefs?: readonly string[],\n\t\toptions?: { readonly configConfinedToRefs?: boolean; readonly movedWorktrees?: readonly string[] },\n\t): void {\n\t\t// Everything the watcher would have cleared for the write, since its own file events are dropped once it is\n\t\t// announced (the typed write's `onReset` names only what it must evict)\n\t\tthis.resetForChanges(repoPath, changes, undefined);\n\t\t// Worktrees share refs, tags, stash, remotes and config, so a typed write in one changes what its siblings show;\n\t\t// the host hears the shared part of it for each, and they read fresh. Every path is reset before any is\n\t\t// announced, so a read the host starts on hearing one path isn't evicted by the next path's reset\n\t\tconst siblings = this.getSiblingChanges(repoPath, changes);\n\t\tfor (const [path, shared] of siblings) {\n\t\t\tthis.resetForChanges(path, shared, undefined, 'sibling');\n\t\t}\n\n\t\tthis.announceChanged(repoPath, changes, refs, options);\n\t\tif (siblings.size === 0) return;\n\n\t\t// Siblings share the one `.git/config`, so the write's config is as confined for them, and they hear the same\n\t\t// worktrees moved\n\t\tconst sharedRefs = refs?.length ? getSharedRefs(changes, refs) : undefined;\n\t\tfor (const [path, shared] of siblings) {\n\t\t\tthis.announceChanged(path, shared, sharedRefs, options);\n\t\t}\n\t}\n\n\t/**\n\t * The linked worktrees whose HEAD a write that ran in `paths` moved, for a `worktreeHead` among `changes` (see\n\t * `AnnouncedRepositoryChanges.movedWorktrees`): those of `paths` when it rewrote their HEAD, which it announces as\n\t * `head`, and otherwise none, as the worktree it added or removed is unknown here; `undefined` without\n\t * `worktreeHead`\n\t */\n\tprivate getMovedWorktrees(paths: readonly string[], changes: readonly RepositoryChange[]): string[] | undefined {\n\t\tif (!changes.includes('worktreeHead')) return undefined;\n\t\tif (!changes.includes('head')) return [];\n\n\t\tconst ids: string[] = [];\n\t\tfor (const path of paths) {\n\t\t\tconst id = this._cache.getLinkedWorktreeId(normalizePath(path));\n\t\t\tif (id != null) {\n\t\t\t\tids.push(id);\n\t\t\t}\n\t\t}\n\t\treturn ids;\n\t}\n\n\t/**\n\t * Tells only the host's own `repository.onChanged` about `changes` — for a follow-up that is not a write of\n\t * core's, such as re-announcing an outside change once it was reconciled. Nothing is evicted, no sibling hears\n\t * it, and the watch layer doesn't take it for a write's announcement.\n\t */\n\tnotifyHost(repoPath: string, changes: RepositoryChange[]): void {\n\t\tthis._hostHooks?.repository?.onChanged?.(repoPath, changes);\n\t}\n\n\t/**\n\t * Tells the host about a write for one path, after its caches were reset — the watch layer hears of it first.\n\t * `refs` are the full ref names the write moved, when it knows them, and `options.configConfinedToRefs` confines\n\t * its `config` change to the sections of the local branches among them (see `GitServiceHooks.repository.onChanged`);\n\t * the confinement is passed on only with `config` among `changes` and a branch in `refs` to confine it to.\n\t * `options.movedWorktrees` reaches the watch layer alone, and only with `worktreeHead` among `changes`.\n\t */\n\tprivate announceChanged(\n\t\trepoPath: string,\n\t\tchanges: RepositoryChange[],\n\t\trefs?: readonly string[],\n\t\toptions?: { readonly configConfinedToRefs?: boolean; readonly movedWorktrees?: readonly string[] },\n\t): void {\n\t\tconst moved =\n\t\t\toptions?.movedWorktrees != null && changes.includes('worktreeHead')\n\t\t\t\t? { movedWorktrees: options.movedWorktrees }\n\t\t\t\t: undefined;\n\t\tif (refs?.length) {\n\t\t\tif (\n\t\t\t\toptions?.configConfinedToRefs === true &&\n\t\t\t\tchanges.includes('config') &&\n\t\t\t\trefs.some(r => r.startsWith('refs/heads/'))\n\t\t\t) {\n\t\t\t\tthis._onDidAnnounceChanges.fire({\n\t\t\t\t\trepoPath: repoPath,\n\t\t\t\t\tchanges: changes,\n\t\t\t\t\trefs: refs,\n\t\t\t\t\tconfigConfinedToRefs: true,\n\t\t\t\t\t...moved,\n\t\t\t\t});\n\t\t\t\tthis._hostHooks?.repository?.onChanged?.(repoPath, changes, refs, { configConfinedToRefs: true });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._onDidAnnounceChanges.fire({ repoPath: repoPath, changes: changes, refs: refs, ...moved });\n\t\t\tthis._hostHooks?.repository?.onChanged?.(repoPath, changes, refs);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._onDidAnnounceChanges.fire({ repoPath: repoPath, changes: changes, ...moved });\n\t\tthis._hostHooks?.repository?.onChanged?.(repoPath, changes);\n\t}\n\n\t/**\n\t * What the worktrees sharing a repository hear of `changes` that ran in one of them: the part worktrees\n\t * share (see {@link worktreeSharedChanges}), or `undefined` when `changes` has none. An empty `changes` or\n\t * `'unknown'` means everything may have changed, so it reaches them as every shared kind — never as\n\t * `'unknown'` itself, which a host treats as the end of a watch session; `'closed'` concerns the one path\n\t * alone and reaches none.\n\t */\n\tprivate getSharedChanges(changes: readonly RepositoryChange[]): RepositoryChange[] | undefined {\n\t\tif (changes.includes('closed')) return undefined;\n\t\tif (!changes.length || changes.includes('unknown')) return [...worktreeSharedChanges];\n\n\t\tconst shared = changes.filter(c => worktreeSharedChanges.has(c));\n\t\treturn shared.length ? shared : undefined;\n\t}\n\n\t/** What each registered worktree sharing `repoPath`'s repository, other than `repoPath`, hears of `changes`. */\n\tprivate getSiblingChanges(repoPath: string, changes: readonly RepositoryChange[]): Map<string, RepositoryChange[]> {\n\t\tconst siblings = new Map<string, RepositoryChange[]>();\n\t\tconst shared = this.getSharedChanges(changes);\n\t\tif (shared == null) return siblings;\n\n\t\tconst self = normalizePath(repoPath);\n\t\tfor (const path of this._cache.getWorktreePaths(this._cache.getCommonPath(repoPath))) {\n\t\t\tif (path !== self) {\n\t\t\t\tsiblings.set(path, [...shared]);\n\t\t\t}\n\t\t}\n\t\treturn siblings;\n\t}\n\n\t/**\n\t * Evicts what a notified change reset for `repoPath`: the types reset (`[]` = all), or `undefined` for none.\n\t * `heard` is how `repoPath` heard the write:\n\t * - `'all'`: all of it, as the path it ran in or one it was announced whole for, so the changes are announced for it\n\t * (see `Cache.applyRepositoryChanges`)\n\t * - `'shared'`: the shared part, as the caller's `cwd` of a `-C` write elsewhere, so a `'worktreeHead'` among them is\n\t * another worktree's, which `-C` may have named by a folder inside it, and every other linked worktree loses its\n\t * current branch\n\t * - `'sibling'`: the shared part, as a path sharing its repository with one already reset for the same change, which\n\t * evicted the shared entries for every worktree, so the changes evict only its own entries and advance its\n\t * status clock\n\t */\n\tprivate resetForChanges(\n\t\trepoPath: string,\n\t\tchanges: readonly RepositoryChange[],\n\t\tcache: readonly CachedGitTypes[] | 'all' | undefined,\n\t\theard: 'all' | 'shared' | 'sibling' = 'all',\n\t): CachedGitTypes[] | undefined {\n\t\tif (cache != null && cache !== 'all') {\n\t\t\tif (!cache.length) return undefined;\n\n\t\t\tthis._cache.evictCaches(repoPath, ...cache);\n\t\t\treturn [...cache];\n\t\t}\n\n\t\tif (cache === 'all' || !changes.length || changes.some(c => c === 'unknown' || c === 'closed')) {\n\t\t\tthis._cache.evictCaches(repoPath);\n\t\t\treturn [];\n\t\t}\n\n\t\tconst types = this._cache.applyRepositoryChanges(\n\t\t\trepoPath,\n\t\t\tchanges,\n\t\t\t'evict',\n\t\t\theard === 'sibling' ? { worktreeOnly: true } : { announced: heard === 'all' },\n\t\t);\n\t\treturn types.length ? types : undefined;\n\t}\n\n\t/** `repoPath` and every worktree registered as sharing its repository, since a shared-ref write moves them all. */\n\tprivate getRepositoryPaths(repoPath: string): string[] {\n\t\tconst commonPath = this._cache.getCommonPath(repoPath);\n\t\treturn [...new Set([repoPath, commonPath, ...this._cache.getWorktreePaths(commonPath)])];\n\t}\n\n\tprivate _blame: BlameGitSubProvider | undefined;\n\tget blame(): BlameGitSubProvider {\n\t\treturn (this._blame ??= new BlameGitSubProvider(\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _branches: BranchesGitSubProvider | undefined;\n\tget branches(): BranchesGitSubProvider {\n\t\treturn (this._branches ??= new BranchesGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _commits: CommitsGitSubProvider | undefined;\n\tget commits(): CommitsGitSubProvider {\n\t\treturn (this._commits ??= new CommitsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _config: ConfigGitSubProvider | undefined;\n\tget config(): ConfigGitSubProvider {\n\t\treturn (this._config ??= new ConfigGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _contributors: ContributorsGitSubProvider | undefined;\n\tget contributors(): ContributorsGitSubProvider {\n\t\treturn (this._contributors ??= new ContributorsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _diff: DiffGitSubProvider | undefined;\n\tget diff(): DiffGitSubProvider {\n\t\treturn (this._diff ??= new DiffGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _graph: GraphGitSubProvider | undefined;\n\tget graph(): GraphGitSubProvider {\n\t\treturn (this._graph ??= new GraphGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _maintenance: MaintenanceGitSubProvider | undefined;\n\t// Optional so subclasses whose repos aren't local can report the capability as absent — see\n\t// `VslsGitProvider`. Consumers already treat `maintenance == null` as \"unsupported here\" (web builds\n\t// never register it at all).\n\tget maintenance(): MaintenanceGitSubProvider | undefined {\n\t\tif (!this._localRepositories) return undefined;\n\n\t\treturn (this._maintenance ??= new MaintenanceGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _ops: OperationsGitSubProvider | undefined;\n\tget ops(): OperationsGitSubProvider {\n\t\treturn (this._ops ??= new OperationsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t\tthis._indexRefresher,\n\t\t));\n\t}\n\n\tprivate _patch: PatchGitSubProvider | undefined;\n\tget patch(): PatchGitSubProvider {\n\t\treturn (this._patch ??= new PatchGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _pausedOps: PausedOperationsGitSubProvider | undefined;\n\tget pausedOps(): PausedOperationsGitSubProvider {\n\t\treturn (this._pausedOps ??= new PausedOperationsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t\tthis._indexRefresher,\n\t\t));\n\t}\n\n\tprivate _refs: RefsGitSubProvider | undefined;\n\tget refs(): RefsGitSubProvider {\n\t\treturn (this._refs ??= new RefsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _remotes: RemotesGitSubProvider | undefined;\n\tget remotes(): RemotesGitSubProvider {\n\t\treturn (this._remotes ??= new RemotesGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _revision: RevisionGitSubProvider | undefined;\n\tget revision(): RevisionGitSubProvider {\n\t\treturn (this._revision ??= new RevisionGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _staging: StagingGitSubProvider | undefined;\n\tget staging(): StagingGitSubProvider {\n\t\treturn (this._staging ??= new StagingGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _stash: StashGitSubProvider | undefined;\n\tget stash(): StashGitSubProvider {\n\t\treturn (this._stash ??= new StashGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t\tthis._indexRefresher,\n\t\t));\n\t}\n\n\tprivate _status: StatusGitSubProvider | undefined;\n\tget status(): StatusGitSubProvider {\n\t\treturn (this._status ??= new StatusGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _tags: TagsGitSubProvider | undefined;\n\tget tags(): TagsGitSubProvider {\n\t\treturn (this._tags ??= new TagsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _worktrees: WorktreesGitSubProvider | undefined;\n\tget worktrees(): WorktreesGitSubProvider {\n\t\treturn (this._worktrees ??= new WorktreesGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t\tthis._ignoredWorktreeFolders.length ? path => this.getIgnoredWorktreeRoots(path) : undefined,\n\t\t\tthis._indexRefresher,\n\t\t));\n\t}\n\n\tgetAbsoluteUri(pathOrUri: string | Uri, base: string | Uri): Uri {\n\t\tconst baseUri = typeof base !== 'string' ? base : fileUri(base);\n\t\tif (typeof pathOrUri !== 'string') return pathOrUri;\n\t\tif (maybeUri(pathOrUri)) return parseUri(pathOrUri);\n\t\tif (path.isAbsolute(pathOrUri)) return fileUri(pathOrUri);\n\t\treturn joinUriPath(baseUri, pathOrUri);\n\t}\n\n\tgetRelativePath(pathOrUri: string | Uri, base: string | Uri): string {\n\t\tconst [relativePath] = splitPath(toFsPath(pathOrUri), toFsPath(base));\n\t\treturn relativePath;\n\t}\n\n\tasync excludeIgnoredUris(repoPath: string, uris: Uri[]): Promise<Uri[]> {\n\t\tconst filter = this.getIgnoreFilter(repoPath);\n\t\t// Only a watcher refreshes the filter, and nothing may be watching this repository\n\t\tvoid filter.revalidate();\n\t\tawait filter.ready();\n\t\treturn uris.filter(uri => {\n\t\t\tconst relativePath = normalizePath(path.relative(repoPath, toFsPath(uri)));\n\t\t\treturn !relativePath || !filter.isIgnored(relativePath);\n\t\t});\n\t}\n\n\tasync getIgnoredUrisFilter(repoPath: string): Promise<(uri: Uri) => boolean> {\n\t\tconst filter = this.getIgnoreFilter(repoPath);\n\t\tvoid filter.revalidate();\n\t\tawait filter.ready();\n\t\treturn (uri: Uri) => {\n\t\t\tconst relativePath = normalizePath(path.relative(repoPath, toFsPath(uri)));\n\t\t\treturn relativePath ? filter.isIgnored(relativePath) : false;\n\t\t};\n\t}\n\n\tasync getLastFetchedTimestamp(repoPath: string): Promise<number | undefined> {\n\t\treturn this._cache.getLastFetchedTimestamp(repoPath, async (commonPath): Promise<number | undefined> => {\n\t\t\tconst gitDir = await this.config.getGitDir?.(commonPath).catch(() => undefined);\n\t\t\tif (gitDir == null) return undefined;\n\n\t\t\tconst gitDirUri = gitDir.commonUri ?? gitDir.uri;\n\t\t\tconst fetchHeadUri = joinUriPath(gitDirUri, 'FETCH_HEAD');\n\t\t\tconst stats = await this.context.fs.stat(fetchHeadUri);\n\t\t\t// If the file is empty, assume the fetch failed, and don't update the timestamp\n\t\t\tif (stats != null && stats.size > 0) return stats.mtime;\n\n\t\t\treturn undefined;\n\t\t});\n\t}\n\n\tgetIgnoreFilter(repoPath: string): GitIgnoreFilter {\n\t\tlet filter = this._cache.gitIgnore.get(repoPath);\n\t\tif (filter == null) {\n\t\t\tconst gitDir = this._cache.gitDir.get(repoPath);\n\t\t\tconst gitDirPath = gitDir?.uri.fsPath ?? `${repoPath}/.git`;\n\t\t\t// The watch service asks for the filter directly, not through the per-repository sub-providers, and its\n\t\t\t// config listing is shared by the repository's checkouts once this one is registered\n\t\t\tconst getIgnoreConfig = async () => {\n\t\t\t\tawait this._cache.ensureRegistered(repoPath);\n\t\t\t\treturn this.config.getIgnoreConfig(repoPath);\n\t\t\t};\n\t\t\tfilter = new GitIgnoreFilter({\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tgitDirPath: gitDirPath,\n\t\t\t\tfs: this.context.fs,\n\t\t\t\t// Resolved the way git resolves it; unset, git reads its default location instead\n\t\t\t\tgetGlobalExcludesPath: async () => {\n\t\t\t\t\tconst { excludesFile: configured } = await getIgnoreConfig();\n\t\t\t\t\treturn configured != null\n\t\t\t\t\t\t? resolveGitPathConfig(configured, repoPath)\n\t\t\t\t\t\t: getDefaultGlobalExcludesPath();\n\t\t\t\t},\n\t\t\t\t// `info/exclude` lives in the COMMON git dir — a linked worktree's own git dir has none\n\t\t\t\tgetInfoExcludePath: async () => {\n\t\t\t\t\tconst gitDir = await this.config.getGitDir?.(repoPath);\n\t\t\t\t\tif (gitDir == null) return undefined;\n\n\t\t\t\t\treturn `${(gitDir.commonUri ?? gitDir.uri).fsPath}/info/exclude`;\n\t\t\t\t},\n\t\t\t\tgetGitIgnorePaths: () => this.getGitIgnorePaths(repoPath),\n\t\t\t\tgetIgnoreCase: async () => {\n\t\t\t\t\tconst { ignoreCase: value } = await getIgnoreConfig();\n\t\t\t\t\tif (value == null) return undefined;\n\t\t\t\t\tif (parseGitBoolean(value)) return true;\n\n\t\t\t\t\treturn isGitBooleanFalse(value) ? false : undefined;\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis._cache.gitIgnore.set(repoPath, filter);\n\t\t}\n\t\treturn filter;\n\t}\n\n\tasync getIgnoredDirectories(repoPath: string, cancellation?: AbortSignal): Promise<string[]> {\n\t\t// `--directory` collapses a directory to one entry when everything in it is ignored — which includes\n\t\t// directories no rule matches whose current contents merely happen to be ignored (a `logs/` holding only\n\t\t// `*.log` files under a `*.log` rule), so each candidate is confirmed against the rules below\n\t\tconst listed = await this._git.run(\n\t\t\t{ cwd: repoPath, errors: 'throw', cancellation: cancellation },\n\t\t\t'ls-files',\n\t\t\t'-z',\n\t\t\t'--others',\n\t\t\t'--ignored',\n\t\t\t'--exclude-standard',\n\t\t\t'--directory',\n\t\t);\n\n\t\tconst candidates: string[] = [];\n\t\tfor (const entry of iterateByDelimiter(listed.stdout, '\\0')) {\n\t\t\tif (entry.length > 1 && entry.endsWith('/')) {\n\t\t\t\tcandidates.push(entry);\n\t\t\t}\n\t\t}\n\t\tif (!candidates.length) return [];\n\n\t\tconst confirmed = await this.getIgnoredPaths(repoPath, candidates, undefined, cancellation);\n\n\t\tconst directories: string[] = [];\n\t\tfor (const entry of confirmed) {\n\t\t\t// Never `.git` itself, and no name a watcher would read as a pattern\n\t\t\tif (entry.length < 2 || !entry.endsWith('/') || /[*?[\\]{}()!+@\\\\]/.test(entry)) continue;\n\n\t\t\tconst directory = entry.substring(0, entry.length - 1);\n\t\t\tif (directory === '.git') continue;\n\n\t\t\tdirectories.push(directory);\n\t\t}\n\n\t\t// A path sorts after every prefix of it, so an entry's ancestors have already been kept (or not) by the time it\n\t\t// is checked — and the kept set comes out sorted\n\t\tdirectories.sort();\n\n\t\tconst kept = new Set<string>();\n\t\tfor (const directory of directories) {\n\t\t\tlet beneathKept = false;\n\t\t\tfor (let i = directory.indexOf('/'); i !== -1; i = directory.indexOf('/', i + 1)) {\n\t\t\t\tif (kept.has(directory.substring(0, i))) {\n\t\t\t\t\tbeneathKept = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!beneathKept) {\n\t\t\t\tkept.add(directory);\n\t\t\t}\n\t\t}\n\n\t\treturn [...kept];\n\t}\n\n\tasync getIgnoredEntries(\n\t\trepoPath: string,\n\t\toptions?: { paths?: readonly string[]; priority?: GitCommandPriority },\n\t\tcancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tlet paths = options?.paths;\n\t\t// No pathspec means \"everything\" to git, which is not what an empty list asks for\n\t\tif (paths != null && !paths.length) return [];\n\n\t\t// A scope inside an ignored folder makes git list the folder itself, or fail outright, so a scope that is\n\t\t// itself ignored is answered here, as one entry, and left out of the listing\n\t\tconst scopedEntries = new Set<string>();\n\t\tif (paths != null) {\n\t\t\tconst scopes = [...new Set(paths.map(p => (p.length > 1 ? trimTrailingSlashes(p) : p)))];\n\t\t\tconst ignoredScopes = await this.getIgnoredScopes(\n\t\t\t\trepoPath,\n\t\t\t\tscopes.filter(p => p !== ''),\n\t\t\t\toptions?.priority,\n\t\t\t\tcancellation,\n\t\t\t);\n\n\t\t\tconst ignored = [...ignoredScopes];\n\t\t\t// `lstat`, as git lists a symlink as a file even when it points at a folder\n\t\t\tconst listed = await Promise.allSettled(\n\t\t\t\tignored.map(async scope => {\n\t\t\t\t\tconst fullPath = path.join(repoPath, scope);\n\t\t\t\t\tif (!(await fs.lstat(fullPath)).isDirectory()) return scope;\n\n\t\t\t\t\treturn (await hasNonDirectoryEntry(fullPath)) ? `${scope}/` : undefined;\n\t\t\t\t}),\n\t\t\t);\n\t\t\tfor (const result of listed) {\n\t\t\t\t// Not on disk, so nothing is ignored there\n\t\t\t\tif (result.status === 'fulfilled' && result.value != null) {\n\t\t\t\t\tscopedEntries.add(result.value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpaths = scopes.filter(p => !ignoredScopes.has(p));\n\t\t\tif (!paths.length) return [...scopedEntries].sort();\n\t\t}\n\n\t\t// `status --ignored` walks every ignored tree, and `ls-files --directory` drops the ignored entries inside a\n\t\t// new untracked folder, so status is asked only about those folders\n\t\tconst args = ['ls-files', '-z', '--others', '--exclude-standard', '--directory', '--no-empty-directory'];\n\t\tconst runOptions = {\n\t\t\tcwd: repoPath,\n\t\t\terrors: 'throw',\n\t\t\tcancellation: cancellation,\n\t\t\tpriority: options?.priority,\n\t\t} as const;\n\n\t\tconst readListing = async (extra: readonly string[]): Promise<Set<string>> => {\n\t\t\tconst listed = new Set<string>();\n\t\t\tconst prefix = [...args, ...extra];\n\t\t\tfor (const batch of paths != null ? batchLiteralPathspecs(paths, prefix) : [undefined]) {\n\t\t\t\tconst result = await this._git.run(runOptions, ...prefix, ...(batch != null ? ['--', ...batch] : []));\n\t\t\t\tfor (const entry of iterateByDelimiter(result.stdout, '\\0')) {\n\t\t\t\t\tif (entry !== '') {\n\t\t\t\t\t\tlisted.add(entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn listed;\n\t\t};\n\n\t\tconst [ignoredResult, untrackedResult] = await Promise.allSettled([\n\t\t\treadListing(['--ignored']),\n\t\t\treadListing([]),\n\t\t]);\n\t\tif (ignoredResult.status === 'rejected') throw ignoredResult.reason;\n\t\tif (untrackedResult.status === 'rejected') throw untrackedResult.reason;\n\n\t\tconst entries = new Set<string>(scopedEntries);\n\t\tfor (const entry of ignoredResult.value) {\n\t\t\tif (entry !== '.git/') {\n\t\t\t\tentries.add(entry);\n\t\t\t}\n\t\t}\n\n\t\tconst folders: string[] = [];\n\t\tfor (const entry of untrackedResult.value) {\n\t\t\tif (entry.endsWith('/')) {\n\t\t\t\tfolders.push(entry);\n\t\t\t}\n\t\t}\n\t\tif (!folders.length) return [...entries].sort();\n\n\t\t// `matching` reports a folder an ignore rule matches without walking it, but lists each file of a folder that is\n\t\t// ignored only because all of its files are, so `all` untracked files are needed to fold those back\n\t\tconst matching = await this._git.supports('git:status:ignored-matching');\n\t\tconst prefix = [\n\t\t\t'status',\n\t\t\t'--porcelain',\n\t\t\t'-z',\n\t\t\tmatching ? '--ignored=matching' : '--ignored',\n\t\t\tmatching ? '--untracked-files=all' : '--untracked-files=normal',\n\t\t\t'--ignore-submodules=all',\n\t\t];\n\n\t\tconst records: string[] = [];\n\t\tfor (const batch of batchLiteralPathspecs(folders, prefix)) {\n\t\t\tconst listed = await this._git.run(\n\t\t\t\t{\n\t\t\t\t\t...runOptions,\n\t\t\t\t\tconfigs: [...gitConfigsStatus, '-c', 'status.renames=false'],\n\t\t\t\t\tenv: { GIT_OPTIONAL_LOCKS: '0' },\n\t\t\t\t},\n\t\t\t\t...prefix,\n\t\t\t\t'--',\n\t\t\t\t...batch,\n\t\t\t);\n\n\t\t\t// Only untracked folders are in scope, so there are no tracked entries, and no rename pairs, to step over\n\t\t\tfor (const record of iterateByDelimiter(listed.stdout, '\\0')) {\n\t\t\t\tif (matching) {\n\t\t\t\t\trecords.push(record);\n\t\t\t\t} else if (record.startsWith('!! ')) {\n\t\t\t\t\tentries.add(record.substring(3));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (matching) {\n\t\t\tfor (const entry of foldMatchingIgnored(records)) {\n\t\t\t\tentries.add(entry);\n\t\t\t}\n\t\t}\n\t\treturn [...entries].sort();\n\t}\n\n\t/**\n\t * Which of `scopes` are ignored. A scope git refuses (beyond a symlink, inside a submodule) is not ignored, as the\n\t * listing answers it with nothing. Any other failure answers none; when git itself is failing, the listing that\n\t * follows fails too.\n\t */\n\tprivate async getIgnoredScopes(\n\t\trepoPath: string,\n\t\tscopes: readonly string[],\n\t\tpriority: GitCommandPriority | undefined,\n\t\tcancellation: AbortSignal | undefined,\n\t): Promise<Set<string>> {\n\t\ttry {\n\t\t\treturn await this.getIgnoredPaths(repoPath, scopes, { priority: priority }, cancellation);\n\t\t} catch (ex) {\n\t\t\tif (isCancellationError(ex)) throw ex;\n\n\t\t\treturn new Set();\n\t\t}\n\t}\n\n\t/**\n\t * `check-ignore` dies on the first path it can't answer (inside a submodule, beyond a symlink, outside the repository,\n\t * or empty), where this repository ignores nothing, having answered every path before it, so the paths after it are\n\t * asked again, less those in the folder of a path refused for a symlink or submodule, which share its fate. Each path\n\t * is answered once, in one run plus one for each refusal. Any other failure is thrown.\n\t */\n\tasync getIgnoredPaths(\n\t\trepoPath: string,\n\t\tpaths: readonly string[],\n\t\toptions?: { priority?: GitCommandPriority },\n\t\tcancellation?: AbortSignal,\n\t): Promise<Set<string>> {\n\t\tconst ignored = new Set<string>();\n\t\tlet pending = paths;\n\t\twhile (pending.length) {\n\t\t\tconst refused = await this.checkIgnore(repoPath, pending, ignored, options, cancellation);\n\t\t\tif (refused == null) break;\n\n\t\t\tconst folder = refused.folderWide ? getRefusedFolder(pending[refused.index]) : undefined;\n\t\t\tpending = pending.slice(refused.index + 1);\n\t\t\tif (folder != null) {\n\t\t\t\tpending = pending.filter(p => !p.startsWith(folder) || hasDotSegment(p));\n\t\t\t}\n\t\t}\n\t\treturn ignored;\n\t}\n\n\t/**\n\t * One `check-ignore` run over `paths`, adding the ignored ones to `ignored`. Returns the path git died on, which\n\t * every path before it was answered ahead of, or `undefined` when all were answered.\n\t */\n\tprivate async checkIgnore(\n\t\trepoPath: string,\n\t\tpaths: readonly string[],\n\t\tignored: Set<string>,\n\t\toptions: { priority?: GitCommandPriority } | undefined,\n\t\tcancellation: AbortSignal | undefined,\n\t): Promise<{ index: number; folderWide: boolean } | undefined> {\n\t\t// check-ignore reads each line as a pathspec, so a leading `:` would be parsed as magic; `./` makes it a literal path\n\t\tconst lines = paths.map(p => (p.startsWith(':') ? `./${p}` : p));\n\n\t\tlet stdout: string;\n\t\tlet refusal: GitError | undefined;\n\t\ttry {\n\t\t\t// `-v -n` writes a record for every path answered, so the records line up with `paths` and end where git died\n\t\t\tconst result = await this._git.run(\n\t\t\t\t{\n\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\terrors: 'throw',\n\t\t\t\t\tcancellation: cancellation,\n\t\t\t\t\tpriority: options?.priority,\n\t\t\t\t\tstdin: `${lines.join('\\0')}\\0`,\n\t\t\t\t\texpectedExitCodes: [1],\n\t\t\t\t},\n\t\t\t\t'check-ignore',\n\t\t\t\t'-v',\n\t\t\t\t'-n',\n\t\t\t\t'-z',\n\t\t\t\t'--stdin',\n\t\t\t);\n\t\t\tstdout = result.stdout;\n\t\t} catch (ex) {\n\t\t\tif (!(ex instanceof GitError) || ex.stderr == null || !GitErrors.pathspecRefused.test(ex.stderr)) throw ex;\n\n\t\t\trefusal = ex;\n\t\t\tstdout = ex.stdout ?? '';\n\t\t}\n\n\t\t// Each record is source, line number, pattern and path; the pattern is empty when none matched, and `!`-prefixed\n\t\t// when it re-includes the path\n\t\tlet index = 0;\n\t\tlet field = 0;\n\t\tlet matched = false;\n\t\tfor (const value of iterateByDelimiter(stdout, '\\0')) {\n\t\t\tif (field === 2) {\n\t\t\t\tmatched = value.length > 0 && !value.startsWith('!');\n\t\t\t} else if (field === 3) {\n\t\t\t\tif (matched && index < paths.length) {\n\t\t\t\t\tignored.add(paths[index]);\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tfield = (field + 1) % 4;\n\t\t}\n\n\t\tif (refusal == null) return undefined;\n\t\t// Every path answered yet git still died, so the refusal can't be pinned to one of them\n\t\tif (index >= paths.length) throw refusal;\n\n\t\treturn { index: index, folderWide: /is (?:beyond a symbolic link|in submodule)/i.test(refusal.stderr ?? '') };\n\t}\n\n\t/** Every `.gitignore` git reads in the working tree (tracked, or untracked and not itself ignored), root included */\n\tprivate async getGitIgnorePaths(repoPath: string): Promise<string[]> {\n\t\tconst result = await this._git.run(\n\t\t\t{ cwd: repoPath, errors: 'throw' },\n\t\t\t'ls-files',\n\t\t\t'-z',\n\t\t\t'--cached',\n\t\t\t'--others',\n\t\t\t'--exclude-standard',\n\t\t\t'--',\n\t\t\t':(glob)**/.gitignore',\n\t\t);\n\n\t\tconst paths: string[] = [];\n\t\tfor (const line of iterateByDelimiter(result.stdout, '\\0')) {\n\t\t\tif (!line.length) continue;\n\n\t\t\tpaths.push(line);\n\t\t}\n\t\treturn paths;\n\t}\n\n\tprivate async isTrackedWithDetails(\n\t\tfilePath: string,\n\t\trepoPath: string,\n\t\trev?: string,\n\t): Promise<{ path: string; status?: GitFileStatus; originalPath?: string } | undefined> {\n\t\tif (rev === deletedOrMissing) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst [relativePath, root] = splitPath(filePath, repoPath);\n\n\t\t\t// Check if the file exists in the working tree first (better cache reuse)\n\t\t\tlet tracked = await this.revision.exists(root, relativePath);\n\t\t\tif (tracked) return { path: relativePath };\n\n\t\t\t// If a specific revision was provided, check there too\n\t\t\tif (rev && !isUncommitted(rev)) {\n\t\t\t\ttracked = await this.revision.exists(root, relativePath, rev);\n\t\t\t\tif (!tracked) {\n\t\t\t\t\t// Check the parent revision (file might have been deleted in this rev)\n\t\t\t\t\ttracked = await this.revision.exists(root, relativePath, `${rev}^`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn tracked ? { path: relativePath } : undefined;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tthis._onDidAnnounceChanges.dispose();\n\t\tthis._indexRefresher.dispose();\n\t\tthis._git.dispose();\n\t\tif (this._cacheOwned) {\n\t\t\tthis._cache.dispose();\n\t\t}\n\t}\n}\n\n/**\n * The names in `refs` a sibling worktree hears with the shared part of `changes`: those of a shared ref kind among\n * `changes`. An empty `changes` or `'unknown'` reaches siblings as every shared kind, unnamed, so none.\n */\nfunction getSharedRefs(changes: readonly RepositoryChange[], refs: readonly string[]): string[] | undefined {\n\tif (!changes.length || changes.includes('unknown')) return undefined;\n\n\tconst shared = refs.filter(r => {\n\t\tif (!r.startsWith('refs/')) return false;\n\n\t\tconst kind = getRefChangeKind(r);\n\t\treturn kind != null && changes.includes(kind) && worktreeSharedChanges.has(kind);\n\t});\n\treturn shared.length ? shared : undefined;\n}\n\n/**\n * Resolves a pathname config value the way git does: a leading `~/` (or a bare `~`) is the home directory, and a\n * relative path is taken from the repository root. Done here rather than with `git config --type=path`, which needs\n * git 2.18, newer than the minimum supported version.\n */\nfunction resolveGitPathConfig(value: string, repoPath: string): string {\n\tif (value === '~' || value.startsWith('~/')) {\n\t\treturn path.join(env.HOME || homedir(), value.substring(1));\n\t}\n\n\treturn path.resolve(repoPath, value);\n}\n\n/** Where git reads global excludes when `core.excludesFile` is unset: `$XDG_CONFIG_HOME/git/ignore`, else `$HOME/.config/git/ignore` */\nfunction getDefaultGlobalExcludesPath(): string | undefined {\n\tconst xdgConfigHome = env.XDG_CONFIG_HOME;\n\tif (xdgConfigHome) return path.join(xdgConfigHome, 'git', 'ignore');\n\n\tconst home = env.HOME || homedir();\n\treturn home ? path.join(home, '.config', 'git', 'ignore') : undefined;\n}\n\n/**\n * The folder of a path git refused for a symlink or submodule in its leading folders, where every other path is refused\n * too; none for a top-level path, or one with `.` or `..` segments, whose folder git would read otherwise\n */\nfunction getRefusedFolder(refused: string): string | undefined {\n\tconst trimmed = trimTrailingSlashes(refused);\n\tif (hasDotSegment(trimmed)) return undefined;\n\n\tconst index = trimmed.lastIndexOf('/');\n\treturn index > 0 ? trimmed.substring(0, index + 1) : undefined;\n}\n\nfunction hasDotSegment(p: string): boolean {\n\treturn /(?:^|\\/)\\.\\.?(?:\\/|$)/.test(p);\n}\n\n/** Whether a folder holds a file or symlink anywhere below it, as git lists no folder without one; an unreadable folder holds none */\nasync function hasNonDirectoryEntry(folder: string): Promise<boolean> {\n\tconst pending = [folder];\n\twhile (pending.length) {\n\t\tconst current = pending.pop()!;\n\t\ttry {\n\t\t\tfor (const entry of await fs.readdir(current, {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,CAAC,CAAC;CAG3D,OAAO,KAAK,QAAQ,UAAU,KAAK;AACpC;;AAGA,SAAS,+BAAmD;CAC3D,MAAM,gBAAgB,IAAI;CAC1B,IAAI,eAAe,OAAO,KAAK,KAAK,eAAe,OAAO,QAAQ;CAElE,MAAM,OAAO,IAAI,QAAQ,QAAQ;CACjC,OAAO,OAAO,KAAK,KAAK,MAAM,WAAW,OAAO,QAAQ,IAAI,KAAA;AAC7D;;;;;AAMA,SAAS,iBAAiB,SAAqC;CAC9D,MAAM,UAAU,oBAAoB,OAAO;CAC3C,IAAI,cAAc,OAAO,GAAG,OAAO,KAAA;CAEnC,MAAM,QAAQ,QAAQ,YAAY,GAAG;CACrC,OAAO,QAAQ,IAAI,QAAQ,UAAU,GAAG,QAAQ,CAAC,IAAI,KAAA;AACtD;AAEA,SAAS,cAAc,GAAoB;CAC1C,OAAO,wBAAwB,KAAK,CAAC;AACtC;;AAGA,eAAe,qBAAqB,QAAkC;CACrE,MAAM,UAAU,CAAC,MAAM;CACvB,OAAO,QAAQ,QAAQ;EACtB,MAAM,UAAU,QAAQ,IAAI;EAC5B,IAAI;GACH,KAAK,MAAM,SAAS,MAAMA,SAAG,QAAQ,SAAS,EAAE,eAAe,KAAK,CAAC,GAAG;IACvE,IAAI,CAAC,MAAM,YAAY,GAAG,OAAO;IAEjC,QAAQ,KAAK,KAAK,KAAK,SAAS,MAAM,IAAI,CAAC;GAC5C;EACD,QAAQ,CAAC;CACV;CACA,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"cliGitProvider.js","names":["fs"],"sources":["../../../git-cli/src/cliGitProvider.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport { homedir } from 'node:os';\nimport * as path from 'node:path';\nimport { env } from 'node:process';\nimport type { CachedGitTypes, MergeTargetsChangeEvent } from '@gitlens/git/cache.js';\nimport { Cache, resetDropsPendingRuns } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport type { GitFileStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { RepositoryChange } from '@gitlens/git/models/repository.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitOperationRunOptions } from '@gitlens/git/providers/operations.js';\nimport type {\n\tAnnouncedRepositoryChanges,\n\tGitProvider,\n\tGitProviderDescriptor,\n} from '@gitlens/git/providers/provider.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { parseGitRemoteUrl } from '@gitlens/git/utils/remote.utils.js';\nimport { isUncommitted } from '@gitlens/git/utils/revision.utils.js';\nimport { getRefChangeKind } from '@gitlens/git/watching/changeEvent.js';\nimport { GitIgnoreFilter } from '@gitlens/git/watching/gitIgnoreFilter.js';\nimport { sanitizeIgnoredWorktreeFolders } from '@gitlens/git/watching/watcherPatterns.js';\nimport { isCancellationError } from '@gitlens/utils/cancellation.js';\nimport type { Event } from '@gitlens/utils/event.js';\nimport { Emitter } from '@gitlens/utils/event.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { joinPaths, maybeUri, normalizePath, splitPath, trimTrailingSlashes } from '@gitlens/utils/path.js';\nimport { cancellable } from '@gitlens/utils/promise.js';\nimport { iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { fileUri, joinUriPath, parseUri, toFsPath } from '@gitlens/utils/uri.js';\nimport { worktreeSharedChanges } from './exec/commandClassifier.js';\nimport { fsExists } from './exec/exec.js';\nimport type { FilteredGitFeatures, GitFeatureOrPrefix, GitFeatures } from './exec/features.js';\nimport type { GitFeatureUnsupportedMessage, GitOptions, NamedRefs } from './exec/git.js';\nimport { batchLiteralPathspecs, Git, gitConfigsStatus, GitError, GitErrors } from './exec/git.js';\nimport { readCommonGitDir, readHeadState } from './exec/headState.js';\nimport type { IndexRefresherOptions } from './exec/indexRefresh.js';\nimport { IndexRefresher } from './exec/indexRefresh.js';\nimport type { GitLocation } from './exec/locator.js';\nimport { foldMatchingIgnored } from './parsers/statusParser.js';\nimport { BlameGitSubProvider } from './providers/blame.js';\nimport { BranchesGitSubProvider } from './providers/branches.js';\nimport { CommitsGitSubProvider } from './providers/commits.js';\nimport { ConfigGitSubProvider, isGitBooleanFalse, parseGitBoolean } from './providers/config.js';\nimport { ContributorsGitSubProvider } from './providers/contributors.js';\nimport { DiffGitSubProvider } from './providers/diff.js';\nimport { GraphGitSubProvider } from './providers/graph.js';\nimport { MaintenanceGitSubProvider } from './providers/maintenance.js';\nimport { OperationsGitSubProvider } from './providers/operations.js';\nimport { PatchGitSubProvider } from './providers/patch.js';\nimport { PausedOperationsGitSubProvider } from './providers/pausedOperations.js';\nimport { RefsGitSubProvider } from './providers/refs.js';\nimport { RemotesGitSubProvider } from './providers/remotes.js';\nimport { RevisionGitSubProvider } from './providers/revision.js';\nimport { StagingGitSubProvider } from './providers/staging.js';\nimport { StashGitSubProvider } from './providers/stash.js';\nimport { StatusGitSubProvider } from './providers/status.js';\nimport { TagsGitSubProvider } from './providers/tags.js';\nimport { WorktreesGitSubProvider } from './providers/worktrees.js';\n\n/** How long reading the folders whose worktrees are ignored may take before it counts as failed (a hung mount) */\nconst ignoredWorktreeRootsTimeoutMs = 5000;\n\nexport interface CliGitProviderOptions {\n\t/** Use an existing Cache instance, or one will be created */\n\tcache?: Cache;\n\t/** Context providing config and event bus hooks */\n\tcontext: GitServiceContext;\n\t/** Function that resolves the git binary location (path + version) */\n\tlocator: () => Promise<GitLocation>;\n\t/** Pre-built Git executor — when provided, used instead of creating a new Git from locator/options */\n\tgit?: Git;\n\t/** Git execution options (timeout, trust, queue config, hooks, etc.) */\n\tgitOptions?: GitOptions;\n\t/**\n\t * Whether repositories reached through this provider are on the LOCAL filesystem. `false` disables the\n\t * maintenance sub-provider entirely (Live Share): its probes stat local paths, and its writes are\n\t * rejected by the host's command allowlist, so inheriting it yields empty reports and swallowed\n\t * failures rather than an honest \"unsupported here\". Defaults to `true`.\n\t */\n\tlocalRepositories?: boolean;\n\t/**\n\t * Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist: they are left out\n\t * of worktree lists, and their add, remove, lock, unlock or move run through `notify: 'infer'`, and the watcher's\n\t * reports of their admin entries, raise no `worktrees` change. The typed worktree writes still announce one. A host\n\t * registers one for a tool's throwaway worktrees, which no host shows (sync-tools' `sync-tools-worktrees`, for one).\n\t * Nothing else is ignored, since a user may keep real worktrees anywhere, the git dir included. A folder that isn't\n\t * a literal path strictly inside the common git dir, or that lies under `worktrees`, is dropped.\n\t */\n\tignoredWorktreeFolders?: readonly string[];\n\t/**\n\t * Refreshes a checkout's index in the background after core's own clone, worktree add, checkout, restore, merge, pull,\n\t * reset, cherry-pick, revert, rebase, stash apply, pop and push, and abort or continue of a paused operation rewrote\n\t * it, so later status and diff reads stop re-hashing the files written in the index's second. A write that stops on\n\t * conflicts refreshes too, since the files it rewrote first are read the most while the conflicts are resolved. Off\n\t * by default: each costs a status of the whole checkout, worth it only where that checkout will be read again.\n\t * `scheduleIndexRefresh` runs either way.\n\t */\n\trefreshIndexAfterWrites?: boolean;\n\t/** The clock and timer behind the background index refresh, for tests; the real ones by default */\n\tindexRefresh?: Pick<IndexRefresherOptions, 'now' | 'setTimer'>;\n}\n\n/**\n * Exposes `isTrackedWithDetails` as a callable method for sub-providers.\n * The class declares it as a regular method, but TypeScript's structural\n * typing makes it inaccessible through the class type alone when consumed\n * internally — this type re-maps it to ensure sub-providers can call it.\n */\nexport type CliGitProviderInternal = Omit<CliGitProvider, 'isTrackedWithDetails'> & {\n\tisTrackedWithDetails: CliGitProvider['isTrackedWithDetails'];\n};\n\n/**\n * A fully-wired CLI-based git provider that executes git commands via `child_process`.\n * Implements both `CliGitProviderInternal` (for internal sub-provider wiring)\n * and `GitProvider` (for registration in a provider registry).\n *\n * @example\n * ```typescript\n * const provider = new CliGitProvider({\n * context: { events: myEvents },\n * locator: () => findGitPath(null),\n * gitOptions: { gitTimeout: 30000 },\n * });\n *\n * const branches = await provider.branches.getBranches(repoPath);\n * const status = await provider.status.getStatus(repoPath);\n * ```\n */\nexport class CliGitProvider implements GitProvider {\n\treadonly descriptor: GitProviderDescriptor = { id: 'git', name: 'Git', virtual: false };\n\n\tprivate readonly _cache: Cache;\n\tprivate readonly _cacheOwned: boolean;\n\tprivate readonly _git: Git;\n\n\treadonly context: GitServiceContext;\n\t/** The host's own hooks, before the provider wraps `cache.onReset` with its own clearing */\n\tprivate readonly _hostHooks: GitServiceContext['hooks'];\n\tprivate readonly _localRepositories: boolean;\n\tprivate readonly _ignoredWorktreeFolders: readonly string[];\n\t/** By common git dir, the folders whose worktrees are ignored there: a common git dir never moves while it is open */\n\tprivate readonly _ignoredWorktreeRoots = new Map<string, Promise<readonly string[]>>();\n\tprivate readonly _indexRefresher: IndexRefresher;\n\tprivate readonly _unregisterListener: { dispose(): void };\n\tprivate readonly _resetListener: { dispose(): void };\n\n\tconstructor(options: CliGitProviderOptions) {\n\t\t// Every typed write announces itself through `onReset`, so the provider clears its own state there\n\t\t// rather than trusting each host to: a host with no handler still reads fresh after a write. A write\n\t\t// hard-evicts, so a caller after it never joins a read that started before it; watcher-driven clears\n\t\t// reach `Cache.clearCaches` directly and keep sharing in-flight reads.\n\t\tconst hostHooks = options.context.hooks;\n\t\tthis._hostHooks = hostHooks;\n\t\tthis.context = {\n\t\t\t...options.context,\n\t\t\thooks: {\n\t\t\t\t...hostHooks,\n\t\t\t\tcache: {\n\t\t\t\t\t...hostHooks?.cache,\n\t\t\t\t\tonReset: (repoPath, ...types) => {\n\t\t\t\t\t\tthis._cache.evictCaches(repoPath, ...types);\n\t\t\t\t\t\tif (resetDropsPendingRuns(types)) {\n\t\t\t\t\t\t\tthis._git.clearPendingCommands(this.getRepositoryPaths(repoPath));\n\t\t\t\t\t\t}\n\t\t\t\t\t\thostHooks?.cache?.onReset?.(repoPath, ...types);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trepository: {\n\t\t\t\t\t...hostHooks?.repository,\n\t\t\t\t\tonChanged: (repoPath, changes, refs, options) =>\n\t\t\t\t\t\tthis.announceWrite(repoPath, changes, refs, {\n\t\t\t\t\t\t\tconfigConfinedToRefs: options?.configConfinedToRefs,\n\t\t\t\t\t\t\tmovedWorktrees: this.getMovedWorktrees([repoPath], changes),\n\t\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t\tthis._localRepositories = options.localRepositories ?? true;\n\t\tthis._ignoredWorktreeFolders = sanitizeIgnoredWorktreeFolders(options.ignoredWorktreeFolders);\n\t\tthis._git =\n\t\t\toptions.git ??\n\t\t\tnew Git(options.locator, {\n\t\t\t\t...options.gitOptions,\n\t\t\t\t// The workspace flag, when the context has one, answers for every path; otherwise the host's own\n\t\t\t\t// per-path predicate (`gitOptions.isTrusted`) stands, so a multi-repository host can refuse one repository\n\t\t\t\tisTrusted:\n\t\t\t\t\toptions.context.workspace?.isTrusted != null\n\t\t\t\t\t\t? () => options.context.workspace!.isTrusted!\n\t\t\t\t\t\t: options.gitOptions?.isTrusted,\n\t\t\t});\n\t\tthis._cacheOwned = !(options.cache instanceof Cache);\n\t\tthis._cache = options.cache instanceof Cache ? options.cache : new Cache();\n\t\tthis._indexRefresher = new IndexRefresher({\n\t\t\t...options.indexRefresh,\n\t\t\tafterWrites: options.refreshIndexAfterWrites,\n\t\t\tgit: this._git,\n\t\t\tstatIndexMtimeMs: checkoutPath => this.statIndexMtimeMs(checkoutPath),\n\t\t});\n\n\t\t// Wires a raw `git.run({ notify })` call back to this provider's own cache/host announcement —\n\t\t// unconditionally, so a host-supplied `options.git` gets bound exactly like one we construct here.\n\t\tthis._git.bindChangeNotifier((repoPaths, changes, sharedPaths, named) =>\n\t\t\tthis.notifyChangedCore(repoPaths, changes, undefined, sharedPaths, named),\n\t\t);\n\t\tthis._git.bindHeadReader(path => readHeadState(path, this.context.fs, this._cache));\n\t\t// Bound even with no folder registered, so a `Git` shared with another provider never keeps that one's folders\n\t\tthis._git.bindIgnoredWorktreeRootsReader(path => this.getIgnoredWorktreeRoots(path));\n\t\tthis._unregisterListener = this._cache.onDidUnregisterRepoPath(repoPath =>\n\t\t\tthis._git.clearPendingCommands([repoPath]),\n\t\t);\n\t\tthis._resetListener = this._cache.onDidReset(() => this._git.clearPendingCommands());\n\t}\n\n\t/** The underlying cache instance (for repo path registration, etc.) */\n\tget cache(): Cache {\n\t\treturn this._cache;\n\t}\n\n\t/** The per-checkout queue that refreshes an index a write left with untrusted entries */\n\tget indexRefresher(): IndexRefresher {\n\t\treturn this._indexRefresher;\n\t}\n\n\tprivate async statIndexMtimeMs(checkoutPath: string): Promise<number | undefined> {\n\t\ttry {\n\t\t\tlet gitDir = this._cache.gitDir.get(checkoutPath);\n\t\t\tif (gitDir == null) {\n\t\t\t\t// A failed clone or worktree add leaves no checkout, and resolving one there anyway would cache, for its\n\t\t\t\t// path, the git dir of whatever repository git falls back to\n\t\t\t\tif (!(await fsExists(path.join(checkoutPath, '.git')))) return undefined;\n\n\t\t\t\tgitDir = await this.config.getGitDir(checkoutPath);\n\t\t\t}\n\t\t\treturn (await fs.stat(path.join(gitDir.uri.fsPath, 'index'))).mtimeMs;\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tget onDidChangeMergeTargets(): Event<MergeTargetsChangeEvent> {\n\t\treturn this._cache.onDidChangeMergeTargets;\n\t}\n\n\tgetIgnoredWorktreeFolders(_repoPath: string): readonly string[] {\n\t\treturn this._ignoredWorktreeFolders;\n\t}\n\n\t/**\n\t * `[]`, reading nothing, when no folder is registered. Read once per common git dir, since a worktree list rebuild\n\t * and every inferred worktree write ask for them; a read that fails or doesn't settle in time (a hung mount) rejects,\n\t * and isn't kept, so the next call reads again\n\t */\n\tasync getIgnoredWorktreeRoots(repoPath: string): Promise<readonly string[]> {\n\t\tif (!this._ignoredWorktreeFolders.length) return [];\n\n\t\tconst commonGitDir = await cancellable(this.findCommonGitDir(repoPath), ignoredWorktreeRootsTimeoutMs);\n\t\tlet roots = this._ignoredWorktreeRoots.get(commonGitDir);\n\t\tif (roots == null) {\n\t\t\tconst read = cancellable(this.readIgnoredWorktreeRoots(commonGitDir), ignoredWorktreeRootsTimeoutMs);\n\t\t\tconst entry = read.then(r => r.roots);\n\t\t\troots = entry;\n\t\t\tthis._ignoredWorktreeRoots.set(commonGitDir, entry);\n\t\t\tconst forget = () => {\n\t\t\t\tif (this._ignoredWorktreeRoots.get(commonGitDir) === entry) {\n\t\t\t\t\tthis._ignoredWorktreeRoots.delete(commonGitDir);\n\t\t\t\t}\n\t\t\t};\n\t\t\t// Roots missing the resolved spelling still serve this call, but a later one resolves again\n\t\t\tvoid read.then(r => (r.resolved ? undefined : forget()), forget);\n\t\t}\n\t\treturn roots;\n\t}\n\n\t/**\n\t * From the cached git dir, or the repository's own files, without running git; a repository whose files don't\n\t * show it (a bare one) runs git once, and the git dir it finds is cached with the repository\n\t */\n\tprivate async findCommonGitDir(repoPath: string): Promise<string> {\n\t\tconst commonGitDir = await readCommonGitDir(repoPath, this.context.fs, this._cache);\n\t\tif (commonGitDir != null) return commonGitDir;\n\n\t\tconst gitDir = await this.config.getGitDir(repoPath);\n\t\treturn (gitDir.commonUri ?? gitDir.uri).fsPath;\n\t}\n\n\t/** `resolved` is false when the common git dir's resolved spelling couldn't be read */\n\tprivate async readIgnoredWorktreeRoots(\n\t\tcommonGitDir: string,\n\t): Promise<{ readonly roots: readonly string[]; readonly resolved: boolean }> {\n\t\tconst roots = new Set(this._ignoredWorktreeFolders.map(f => normalizePath(joinPaths(commonGitDir, f))));\n\t\tif (!this._localRepositories) return { roots: [...roots], resolved: true };\n\n\t\t// Only the common git dir is resolved: a folder doesn't exist until its tool first makes a worktree there\n\t\tconst realCommonGitDir = await fs.realpath(commonGitDir).catch(() => undefined);\n\t\tif (realCommonGitDir == null) return { roots: [...roots], resolved: false };\n\n\t\tfor (const folder of this._ignoredWorktreeFolders) {\n\t\t\troots.add(normalizePath(joinPaths(realCommonGitDir, folder)));\n\t\t}\n\t\treturn { roots: [...roots], resolved: true };\n\t}\n\n\tensureRegistered(repoPath: string): Promise<void> | undefined {\n\t\treturn this._cache.ensureRegistered(repoPath);\n\t}\n\n\tgetCommonPath(repoPath: string): string | undefined {\n\t\t// An unregistered path is its own common path in the cache, which would hide a sibling worktree's writes\n\t\treturn this._cache.isRegistered(repoPath) ? this._cache.getCommonPath(repoPath) : undefined;\n\t}\n\n\tprivate readonly _onDidAnnounceChanges = new Emitter<AnnouncedRepositoryChanges>();\n\tget onDidAnnounceChanges(): Event<AnnouncedRepositoryChanges> {\n\t\treturn this._onDidAnnounceChanges.event;\n\t}\n\n\t/** The underlying git execution instance (for sub-providers that need direct exec/stream access) */\n\tget git(): Git {\n\t\treturn this._git;\n\t}\n\n\t/** Returns whether the installed git version supports the given feature. */\n\tsupports(feature: GitFeatures): boolean | Promise<boolean> {\n\t\treturn this._git.supports(feature);\n\t}\n\n\t/** Returns all features matching the prefix that the installed git version supports. */\n\tsupported<T extends GitFeatureOrPrefix>(feature: T): FilteredGitFeatures<T>[] | Promise<FilteredGitFeatures<T>[]> {\n\t\treturn this._git.supported(feature);\n\t}\n\n\t/** Throws if the installed git version does not support the given feature. */\n\tasync ensureSupports(feature: GitFeatures, prefix: string, suffix: string): Promise<void>;\n\tasync ensureSupports(feature: GitFeatures, message: GitFeatureUnsupportedMessage): Promise<void>;\n\tasync ensureSupports(\n\t\tfeature: GitFeatures,\n\t\tprefixOrMessage: string | GitFeatureUnsupportedMessage,\n\t\tsuffix?: string,\n\t): Promise<void> {\n\t\treturn typeof prefixOrMessage === 'function'\n\t\t\t? this._git.ensureSupports(feature, prefixOrMessage)\n\t\t\t: this._git.ensureSupports(feature, prefixOrMessage, suffix!);\n\t}\n\n\t/** Returns the installed git version string. */\n\tasync version(): Promise<string> {\n\t\treturn this._git.version();\n\t}\n\n\t/** Returns the resolved git binary path. */\n\tasync path(): Promise<string> {\n\t\treturn this._git.path();\n\t}\n\n\tasync clone(\n\t\turl: string,\n\t\tparentPath: string,\n\t\toptions?: { folderName?: string },\n\t\trunOptions?: GitOperationRunOptions,\n\t): Promise<string | undefined> {\n\t\tlet folderPath: string;\n\t\tif (options?.folderName) {\n\t\t\tfolderPath = joinPaths(parentPath, options.folderName);\n\t\t} else {\n\t\t\tconst [, , remotePath] = parseGitRemoteUrl(url);\n\t\t\tconst remoteName = remotePath.split('/').pop();\n\t\t\tif (!remoteName) return undefined;\n\n\t\t\tlet count = 0;\n\t\t\tfolderPath = joinPaths(parentPath, remoteName);\n\t\t\twhile ((await fsExists(folderPath)) && count < 20) {\n\t\t\t\tcount++;\n\t\t\t\tfolderPath = joinPaths(parentPath, `${remoteName}-${count}`);\n\t\t\t}\n\t\t}\n\n\t\t// `throw`: the default handler swallows `remoteConnectionError`, which would return a folder never cloned\n\t\tawait this._indexRefresher.refreshAfter(folderPath, () =>\n\t\t\tthis._git.run({ cwd: parentPath, errors: 'throw', ...runOptions }, 'clone', url, folderPath),\n\t\t);\n\n\t\treturn folderPath;\n\t}\n\n\t/** Creates a new repository at `targetPath` (`git init`), creating it first if it doesn't yet exist. */\n\tasync init(targetPath: string, options?: { defaultBranch?: string; bare?: boolean }): Promise<void> {\n\t\tawait fs.mkdir(targetPath, { recursive: true });\n\n\t\tconst args = ['init'];\n\t\tif (options?.defaultBranch) {\n\t\t\targs.push('-b', options.defaultBranch);\n\t\t}\n\t\tif (options?.bare) {\n\t\t\targs.push('--bare');\n\t\t}\n\n\t\t// Run inside the target rather than naming it from its parent: a relative `targetPath` would otherwise\n\t\t// be resolved against the parent a second time\n\t\tawait this._git.run({ cwd: targetPath }, ...args);\n\t}\n\n\t/**\n\t * Notifies the provider that `repoPath` was mutated outside of a typed sub-provider method — e.g. a\n\t * consumer that ran a command through the raw `git.run`/`provider.git.run` escape hatch. Fires the same\n\t * `cache.onReset`/`repository.onChanged` hooks a typed mutator would, so, exactly as after a typed write,\n\t * the provider hard-evicts its own caches for `repoPath` and drops its pending commands for the repository\n\t * (its sibling worktrees included) before the host's handlers run.\n\t *\n\t * What is reset: `options.cache` when given (`'all'` for everything, `[]` for nothing); otherwise the\n\t * cache types `changes` map to, the same mapping a file watcher's changes get, status clock included.\n\t * An empty `changes`, or one naming `'unknown'` or `'closed'`, resets everything. Changes that map to\n\t * no cache type (e.g. `'starred'`) reset nothing, and `onReset` doesn't fire; `onChanged` always fires.\n\t */\n\tnotifyChanged(\n\t\trepoPath: string,\n\t\tchanges: readonly RepositoryChange[],\n\t\toptions?: { cache?: readonly CachedGitTypes[] | 'all' },\n\t): void {\n\t\tthis.notifyChangedCore([repoPath], changes, options);\n\t}\n\n\t/**\n\t * {@link notifyChanged} for one change seen from several paths, e.g. a `-C` shared-state verb announced\n\t * for both its target and the caller's `cwd`. Each path's caches are reset and the host's `onReset` fires\n\t * for each, since a host may keep per-worktree state, but a repository's pending commands are dropped once\n\t * however many of its worktrees are named.\n\t *\n\t * Each path hears the announcement once: `repoPaths` hear all of `changes`, `sharedPaths` (reset and\n\t * `onReset`-ed like `repoPaths`) and then the other registered worktrees sharing a repository with any of\n\t * them (reset like a typed write's, with no `onReset`) hear the shared part of it, see\n\t * {@link getSiblingChanges}. `names.refs` reach `repoPaths` whole and the others as {@link getSharedRefs}.\n\t */\n\tprivate notifyChangedCore(\n\t\trepoPaths: readonly string[],\n\t\tchanges: readonly RepositoryChange[],\n\t\toptions?: { cache?: readonly CachedGitTypes[] | 'all' },\n\t\tsharedPaths?: readonly string[],\n\t\tnames?: NamedRefs,\n\t): void {\n\t\tconst announcements = new Map<string, readonly RepositoryChange[]>();\n\t\tfor (const repoPath of repoPaths) {\n\t\t\tannouncements.set(repoPath, [...changes]);\n\t\t}\n\t\tconst shared = sharedPaths?.length ? this.getSharedChanges(changes) : undefined;\n\t\tif (shared != null) {\n\t\t\tfor (const path of sharedPaths!) {\n\t\t\t\tif (!announcements.has(path)) {\n\t\t\t\t\tannouncements.set(path, shared);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst resets: { repoPath: string; types: CachedGitTypes[] }[] = [];\n\t\tconst pendingPaths = new Set<string>();\n\t\tfor (const [repoPath, announced] of announcements) {\n\t\t\tconst types = this.resetForChanges(\n\t\t\t\trepoPath,\n\t\t\t\tannounced,\n\t\t\t\toptions?.cache,\n\t\t\t\trepoPaths.includes(repoPath) ? 'all' : 'shared',\n\t\t\t);\n\t\t\tif (types == null) {\n\t\t\t\t// A gk config change is reconciled outside the cache types, but its re-read must not join a pre-write run\n\t\t\t\tif (options?.cache == null && announced.includes('gkConfig')) {\n\t\t\t\t\tfor (const path of this.getRepositoryPaths(repoPath)) {\n\t\t\t\t\t\tpendingPaths.add(path);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tresets.push({ repoPath: repoPath, types: types });\n\t\t\tif (resetDropsPendingRuns(types)) {\n\t\t\t\tfor (const path of this.getRepositoryPaths(repoPath)) {\n\t\t\t\t\tpendingPaths.add(path);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// The worktrees no one named: their shared refs, tags, stash, remotes and config just changed too\n\t\tconst named = [...announcements.keys()];\n\t\tfor (const repoPath of named) {\n\t\t\tfor (const [path, siblingChanges] of this.getSiblingChanges(repoPath, changes)) {\n\t\t\t\tif (announcements.has(path)) continue;\n\n\t\t\t\tannouncements.set(path, siblingChanges);\n\t\t\t\tthis.resetForChanges(path, siblingChanges, options?.cache, 'sibling');\n\t\t\t}\n\t\t}\n\n\t\tif (pendingPaths.size) {\n\t\t\tthis._git.clearPendingCommands([...pendingPaths]);\n\t\t}\n\t\tfor (const { repoPath, types } of resets) {\n\t\t\tthis._hostHooks?.cache?.onReset?.(repoPath, ...types);\n\t\t}\n\t\t// The host's own hook: `context.hooks.repository.onChanged` also fans out to siblings, which would\n\t\t// announce a path a second time\n\t\tconst sharedRefs = names?.refs.length ? getSharedRefs(changes, names.refs) : undefined;\n\t\tconst movedWorktrees = this.getMovedWorktrees(repoPaths, changes);\n\t\tfor (const [path, announced] of announcements) {\n\t\t\tthis.announceChanged(path, [...announced], repoPaths.includes(path) ? names?.refs : sharedRefs, {\n\t\t\t\tconfigConfinedToRefs: names?.configConfinedToRefs,\n\t\t\t\tmovedWorktrees: movedWorktrees,\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Announces a typed write that ran in `repoPath`, as `context.hooks.repository.onChanged` does, for a write that\n\t * knows which linked worktrees' HEADs it moved (see `AnnouncedRepositoryChanges.movedWorktrees`) where `repoPath`\n\t * doesn't say: a worktree added or removed from it. `options.configConfinedToRefs` is as for the hook.\n\t *\n\t * @internal not intended to be used outside of the sub-providers\n\t */\n\tannounceWrite(\n\t\trepoPath: string,\n\t\tchanges: RepositoryChange[],\n\t\trefs?: readonly string[],\n\t\toptions?: { readonly configConfinedToRefs?: boolean; readonly movedWorktrees?: readonly string[] },\n\t): void {\n\t\t// Everything the watcher would have cleared for the write, since its own file events are dropped once it is\n\t\t// announced (the typed write's `onReset` names only what it must evict)\n\t\tthis.resetForChanges(repoPath, changes, undefined);\n\t\t// Worktrees share refs, tags, stash, remotes and config, so a typed write in one changes what its siblings show;\n\t\t// the host hears the shared part of it for each, and they read fresh. Every path is reset before any is\n\t\t// announced, so a read the host starts on hearing one path isn't evicted by the next path's reset\n\t\tconst siblings = this.getSiblingChanges(repoPath, changes);\n\t\tfor (const [path, shared] of siblings) {\n\t\t\tthis.resetForChanges(path, shared, undefined, 'sibling');\n\t\t}\n\n\t\tthis.announceChanged(repoPath, changes, refs, options);\n\t\tif (siblings.size === 0) return;\n\n\t\t// Siblings share the one `.git/config`, so the write's config is as confined for them, and they hear the same\n\t\t// worktrees moved\n\t\tconst sharedRefs = refs?.length ? getSharedRefs(changes, refs) : undefined;\n\t\tfor (const [path, shared] of siblings) {\n\t\t\tthis.announceChanged(path, shared, sharedRefs, options);\n\t\t}\n\t}\n\n\t/**\n\t * The linked worktrees whose HEAD a write that ran in `paths` moved, for a `worktreeHead` among `changes` (see\n\t * `AnnouncedRepositoryChanges.movedWorktrees`): those of `paths` when it rewrote their HEAD, which it announces as\n\t * `head`, and otherwise none, as the worktree it added or removed is unknown here; `undefined` without\n\t * `worktreeHead`\n\t */\n\tprivate getMovedWorktrees(paths: readonly string[], changes: readonly RepositoryChange[]): string[] | undefined {\n\t\tif (!changes.includes('worktreeHead')) return undefined;\n\t\tif (!changes.includes('head')) return [];\n\n\t\tconst ids: string[] = [];\n\t\tfor (const path of paths) {\n\t\t\tconst id = this._cache.getLinkedWorktreeId(normalizePath(path));\n\t\t\tif (id != null) {\n\t\t\t\tids.push(id);\n\t\t\t}\n\t\t}\n\t\treturn ids;\n\t}\n\n\t/**\n\t * Tells only the host's own `repository.onChanged` about `changes` — for a follow-up that is not a write of\n\t * core's, such as re-announcing an outside change once it was reconciled. Nothing is evicted, no sibling hears\n\t * it, and the watch layer doesn't take it for a write's announcement.\n\t */\n\tnotifyHost(repoPath: string, changes: RepositoryChange[]): void {\n\t\tthis._hostHooks?.repository?.onChanged?.(repoPath, changes);\n\t}\n\n\t/**\n\t * Tells the host about a write for one path, after its caches were reset — the watch layer hears of it first.\n\t * `refs` are the full ref names the write moved, when it knows them, and `options.configConfinedToRefs` confines\n\t * its `config` change to the sections of the local branches among them (see `GitServiceHooks.repository.onChanged`);\n\t * the confinement is passed on only with `config` among `changes` and a branch in `refs` to confine it to.\n\t * `options.movedWorktrees` reaches the watch layer alone, and only with `worktreeHead` among `changes`.\n\t */\n\tprivate announceChanged(\n\t\trepoPath: string,\n\t\tchanges: RepositoryChange[],\n\t\trefs?: readonly string[],\n\t\toptions?: { readonly configConfinedToRefs?: boolean; readonly movedWorktrees?: readonly string[] },\n\t): void {\n\t\tconst moved =\n\t\t\toptions?.movedWorktrees != null && changes.includes('worktreeHead')\n\t\t\t\t? { movedWorktrees: options.movedWorktrees }\n\t\t\t\t: undefined;\n\t\tif (refs?.length) {\n\t\t\tif (\n\t\t\t\toptions?.configConfinedToRefs === true &&\n\t\t\t\tchanges.includes('config') &&\n\t\t\t\trefs.some(r => r.startsWith('refs/heads/'))\n\t\t\t) {\n\t\t\t\tthis._onDidAnnounceChanges.fire({\n\t\t\t\t\trepoPath: repoPath,\n\t\t\t\t\tchanges: changes,\n\t\t\t\t\trefs: refs,\n\t\t\t\t\tconfigConfinedToRefs: true,\n\t\t\t\t\t...moved,\n\t\t\t\t});\n\t\t\t\tthis._hostHooks?.repository?.onChanged?.(repoPath, changes, refs, { configConfinedToRefs: true });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._onDidAnnounceChanges.fire({ repoPath: repoPath, changes: changes, refs: refs, ...moved });\n\t\t\tthis._hostHooks?.repository?.onChanged?.(repoPath, changes, refs);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._onDidAnnounceChanges.fire({ repoPath: repoPath, changes: changes, ...moved });\n\t\tthis._hostHooks?.repository?.onChanged?.(repoPath, changes);\n\t}\n\n\t/**\n\t * What the worktrees sharing a repository hear of `changes` that ran in one of them: the part worktrees\n\t * share (see {@link worktreeSharedChanges}), or `undefined` when `changes` has none. An empty `changes` or\n\t * `'unknown'` means everything may have changed, so it reaches them as every shared kind — never as\n\t * `'unknown'` itself, which a host treats as the end of a watch session; `'closed'` concerns the one path\n\t * alone and reaches none.\n\t */\n\tprivate getSharedChanges(changes: readonly RepositoryChange[]): RepositoryChange[] | undefined {\n\t\tif (changes.includes('closed')) return undefined;\n\t\tif (!changes.length || changes.includes('unknown')) return [...worktreeSharedChanges];\n\n\t\tconst shared = changes.filter(c => worktreeSharedChanges.has(c));\n\t\treturn shared.length ? shared : undefined;\n\t}\n\n\t/** What each registered worktree sharing `repoPath`'s repository, other than `repoPath`, hears of `changes`. */\n\tprivate getSiblingChanges(repoPath: string, changes: readonly RepositoryChange[]): Map<string, RepositoryChange[]> {\n\t\tconst siblings = new Map<string, RepositoryChange[]>();\n\t\tconst shared = this.getSharedChanges(changes);\n\t\tif (shared == null) return siblings;\n\n\t\tconst self = normalizePath(repoPath);\n\t\tfor (const path of this._cache.getWorktreePaths(this._cache.getCommonPath(repoPath))) {\n\t\t\tif (path !== self) {\n\t\t\t\tsiblings.set(path, [...shared]);\n\t\t\t}\n\t\t}\n\t\treturn siblings;\n\t}\n\n\t/**\n\t * Evicts what a notified change reset for `repoPath`: the types reset (`[]` = all), or `undefined` for none.\n\t * `heard` is how `repoPath` heard the write:\n\t * - `'all'`: all of it, as the path it ran in or one it was announced whole for, so the changes are announced for it\n\t * (see `Cache.applyRepositoryChanges`)\n\t * - `'shared'`: the shared part, as the caller's `cwd` of a `-C` write elsewhere, so a `'worktreeHead'` among them is\n\t * another worktree's, which `-C` may have named by a folder inside it, and every other linked worktree loses its\n\t * current branch\n\t * - `'sibling'`: the shared part, as a path sharing its repository with one already reset for the same change, which\n\t * evicted the shared entries for every worktree, so the changes evict only its own entries and advance its\n\t * status clock\n\t */\n\tprivate resetForChanges(\n\t\trepoPath: string,\n\t\tchanges: readonly RepositoryChange[],\n\t\tcache: readonly CachedGitTypes[] | 'all' | undefined,\n\t\theard: 'all' | 'shared' | 'sibling' = 'all',\n\t): CachedGitTypes[] | undefined {\n\t\tif (cache != null && cache !== 'all') {\n\t\t\tif (!cache.length) return undefined;\n\n\t\t\tthis._cache.evictCaches(repoPath, ...cache);\n\t\t\treturn [...cache];\n\t\t}\n\n\t\tif (cache === 'all' || !changes.length || changes.some(c => c === 'unknown' || c === 'closed')) {\n\t\t\tthis._cache.evictCaches(repoPath);\n\t\t\treturn [];\n\t\t}\n\n\t\tconst types = this._cache.applyRepositoryChanges(\n\t\t\trepoPath,\n\t\t\tchanges,\n\t\t\t'evict',\n\t\t\theard === 'sibling' ? { worktreeOnly: true } : { announced: heard === 'all' },\n\t\t);\n\t\treturn types.length ? types : undefined;\n\t}\n\n\t/** `repoPath` and every worktree registered as sharing its repository, since a shared-ref write moves them all. */\n\tprivate getRepositoryPaths(repoPath: string): string[] {\n\t\tconst commonPath = this._cache.getCommonPath(repoPath);\n\t\treturn [...new Set([repoPath, commonPath, ...this._cache.getWorktreePaths(commonPath)])];\n\t}\n\n\tprivate _blame: BlameGitSubProvider | undefined;\n\tget blame(): BlameGitSubProvider {\n\t\treturn (this._blame ??= new BlameGitSubProvider(\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _branches: BranchesGitSubProvider | undefined;\n\tget branches(): BranchesGitSubProvider {\n\t\treturn (this._branches ??= new BranchesGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _commits: CommitsGitSubProvider | undefined;\n\tget commits(): CommitsGitSubProvider {\n\t\treturn (this._commits ??= new CommitsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _config: ConfigGitSubProvider | undefined;\n\tget config(): ConfigGitSubProvider {\n\t\treturn (this._config ??= new ConfigGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _contributors: ContributorsGitSubProvider | undefined;\n\tget contributors(): ContributorsGitSubProvider {\n\t\treturn (this._contributors ??= new ContributorsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _diff: DiffGitSubProvider | undefined;\n\tget diff(): DiffGitSubProvider {\n\t\treturn (this._diff ??= new DiffGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _graph: GraphGitSubProvider | undefined;\n\tget graph(): GraphGitSubProvider {\n\t\treturn (this._graph ??= new GraphGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _maintenance: MaintenanceGitSubProvider | undefined;\n\t// Optional so subclasses whose repos aren't local can report the capability as absent — see\n\t// `VslsGitProvider`. Consumers already treat `maintenance == null` as \"unsupported here\" (web builds\n\t// never register it at all).\n\tget maintenance(): MaintenanceGitSubProvider | undefined {\n\t\tif (!this._localRepositories) return undefined;\n\n\t\treturn (this._maintenance ??= new MaintenanceGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _ops: OperationsGitSubProvider | undefined;\n\tget ops(): OperationsGitSubProvider {\n\t\treturn (this._ops ??= new OperationsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t\tthis._indexRefresher,\n\t\t));\n\t}\n\n\tprivate _patch: PatchGitSubProvider | undefined;\n\tget patch(): PatchGitSubProvider {\n\t\treturn (this._patch ??= new PatchGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _pausedOps: PausedOperationsGitSubProvider | undefined;\n\tget pausedOps(): PausedOperationsGitSubProvider {\n\t\treturn (this._pausedOps ??= new PausedOperationsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t\tthis._indexRefresher,\n\t\t));\n\t}\n\n\tprivate _refs: RefsGitSubProvider | undefined;\n\tget refs(): RefsGitSubProvider {\n\t\treturn (this._refs ??= new RefsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _remotes: RemotesGitSubProvider | undefined;\n\tget remotes(): RemotesGitSubProvider {\n\t\treturn (this._remotes ??= new RemotesGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _revision: RevisionGitSubProvider | undefined;\n\tget revision(): RevisionGitSubProvider {\n\t\treturn (this._revision ??= new RevisionGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _staging: StagingGitSubProvider | undefined;\n\tget staging(): StagingGitSubProvider {\n\t\treturn (this._staging ??= new StagingGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _stash: StashGitSubProvider | undefined;\n\tget stash(): StashGitSubProvider {\n\t\treturn (this._stash ??= new StashGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t\tthis._indexRefresher,\n\t\t));\n\t}\n\n\tprivate _status: StatusGitSubProvider | undefined;\n\tget status(): StatusGitSubProvider {\n\t\treturn (this._status ??= new StatusGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _tags: TagsGitSubProvider | undefined;\n\tget tags(): TagsGitSubProvider {\n\t\treturn (this._tags ??= new TagsGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t));\n\t}\n\n\tprivate _worktrees: WorktreesGitSubProvider | undefined;\n\tget worktrees(): WorktreesGitSubProvider {\n\t\treturn (this._worktrees ??= new WorktreesGitSubProvider(\n\t\t\tthis.context,\n\t\t\tthis._git,\n\t\t\tthis._cache,\n\t\t\tthis as unknown as CliGitProviderInternal,\n\t\t\tthis._ignoredWorktreeFolders.length ? path => this.getIgnoredWorktreeRoots(path) : undefined,\n\t\t\tthis._indexRefresher,\n\t\t));\n\t}\n\n\tgetAbsoluteUri(pathOrUri: string | Uri, base: string | Uri): Uri {\n\t\tconst baseUri = typeof base !== 'string' ? base : fileUri(base);\n\t\tif (typeof pathOrUri !== 'string') return pathOrUri;\n\t\tif (maybeUri(pathOrUri)) return parseUri(pathOrUri);\n\t\tif (path.isAbsolute(pathOrUri)) return fileUri(pathOrUri);\n\t\treturn joinUriPath(baseUri, pathOrUri);\n\t}\n\n\tgetRelativePath(pathOrUri: string | Uri, base: string | Uri): string {\n\t\tconst [relativePath] = splitPath(toFsPath(pathOrUri), toFsPath(base));\n\t\treturn relativePath;\n\t}\n\n\tasync excludeIgnoredUris(repoPath: string, uris: Uri[]): Promise<Uri[]> {\n\t\tconst filter = this.getIgnoreFilter(repoPath);\n\t\t// Only a watcher refreshes the filter, and nothing may be watching this repository\n\t\tvoid filter.revalidate();\n\t\tawait filter.ready();\n\t\treturn uris.filter(uri => {\n\t\t\tconst relativePath = normalizePath(path.relative(repoPath, toFsPath(uri)));\n\t\t\treturn !relativePath || !filter.isIgnored(relativePath);\n\t\t});\n\t}\n\n\tasync getIgnoredUrisFilter(repoPath: string): Promise<(uri: Uri) => boolean> {\n\t\tconst filter = this.getIgnoreFilter(repoPath);\n\t\tvoid filter.revalidate();\n\t\tawait filter.ready();\n\t\treturn (uri: Uri) => {\n\t\t\tconst relativePath = normalizePath(path.relative(repoPath, toFsPath(uri)));\n\t\t\treturn relativePath ? filter.isIgnored(relativePath) : false;\n\t\t};\n\t}\n\n\tasync getLastFetchedTimestamp(repoPath: string): Promise<number | undefined> {\n\t\treturn this._cache.getLastFetchedTimestamp(repoPath, async (commonPath): Promise<number | undefined> => {\n\t\t\tconst gitDir = await this.config.getGitDir?.(commonPath).catch(() => undefined);\n\t\t\tif (gitDir == null) return undefined;\n\n\t\t\tconst gitDirUri = gitDir.commonUri ?? gitDir.uri;\n\t\t\tconst fetchHeadUri = joinUriPath(gitDirUri, 'FETCH_HEAD');\n\t\t\tconst stats = await this.context.fs.stat(fetchHeadUri);\n\t\t\t// If the file is empty, assume the fetch failed, and don't update the timestamp\n\t\t\tif (stats != null && stats.size > 0) return stats.mtime;\n\n\t\t\treturn undefined;\n\t\t});\n\t}\n\n\tgetIgnoreFilter(repoPath: string): GitIgnoreFilter {\n\t\tlet filter = this._cache.gitIgnore.get(repoPath);\n\t\tif (filter == null) {\n\t\t\tconst gitDir = this._cache.gitDir.get(repoPath);\n\t\t\tconst gitDirPath = gitDir?.uri.fsPath ?? `${repoPath}/.git`;\n\t\t\t// The watch service asks for the filter directly, not through the per-repository sub-providers, and its\n\t\t\t// config listing is shared by the repository's checkouts once this one is registered\n\t\t\tconst getIgnoreConfig = async () => {\n\t\t\t\tawait this._cache.ensureRegistered(repoPath);\n\t\t\t\treturn this.config.getIgnoreConfig(repoPath);\n\t\t\t};\n\t\t\tfilter = new GitIgnoreFilter({\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tgitDirPath: gitDirPath,\n\t\t\t\tfs: this.context.fs,\n\t\t\t\t// Resolved the way git resolves it; unset, git reads its default location instead\n\t\t\t\tgetGlobalExcludesPath: async () => {\n\t\t\t\t\tconst { excludesFile: configured } = await getIgnoreConfig();\n\t\t\t\t\treturn configured != null\n\t\t\t\t\t\t? resolveGitPathConfig(configured, repoPath)\n\t\t\t\t\t\t: getDefaultGlobalExcludesPath();\n\t\t\t\t},\n\t\t\t\t// `info/exclude` lives in the COMMON git dir — a linked worktree's own git dir has none\n\t\t\t\tgetInfoExcludePath: async () => {\n\t\t\t\t\tconst gitDir = await this.config.getGitDir?.(repoPath);\n\t\t\t\t\tif (gitDir == null) return undefined;\n\n\t\t\t\t\treturn `${(gitDir.commonUri ?? gitDir.uri).fsPath}/info/exclude`;\n\t\t\t\t},\n\t\t\t\tgetGitIgnorePaths: () => this.getGitIgnorePaths(repoPath),\n\t\t\t\tgetIgnoreCase: async () => {\n\t\t\t\t\tconst { ignoreCase: value } = await getIgnoreConfig();\n\t\t\t\t\tif (value == null) return undefined;\n\t\t\t\t\tif (parseGitBoolean(value)) return true;\n\n\t\t\t\t\treturn isGitBooleanFalse(value) ? false : undefined;\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis._cache.gitIgnore.set(repoPath, filter);\n\t\t}\n\t\treturn filter;\n\t}\n\n\tasync getIgnoredDirectories(repoPath: string, cancellation?: AbortSignal): Promise<string[]> {\n\t\t// `--directory` collapses a directory to one entry when everything in it is ignored — which includes\n\t\t// directories no rule matches whose current contents merely happen to be ignored (a `logs/` holding only\n\t\t// `*.log` files under a `*.log` rule), so each candidate is confirmed against the rules below\n\t\tconst listed = await this._git.run(\n\t\t\t{ cwd: repoPath, errors: 'throw', cancellation: cancellation },\n\t\t\t'ls-files',\n\t\t\t'-z',\n\t\t\t'--others',\n\t\t\t'--ignored',\n\t\t\t'--exclude-standard',\n\t\t\t'--directory',\n\t\t);\n\n\t\tconst candidates: string[] = [];\n\t\tfor (const entry of iterateByDelimiter(listed.stdout, '\\0')) {\n\t\t\tif (entry.length > 1 && entry.endsWith('/')) {\n\t\t\t\tcandidates.push(entry);\n\t\t\t}\n\t\t}\n\t\tif (!candidates.length) return [];\n\n\t\tconst confirmed = await this.getIgnoredPaths(repoPath, candidates, undefined, cancellation);\n\n\t\tconst directories: string[] = [];\n\t\tfor (const entry of confirmed) {\n\t\t\t// Never `.git` itself, and no name a watcher would read as a pattern\n\t\t\tif (entry.length < 2 || !entry.endsWith('/') || /[*?[\\]{}()!+@\\\\]/.test(entry)) continue;\n\n\t\t\tconst directory = entry.substring(0, entry.length - 1);\n\t\t\tif (directory === '.git') continue;\n\n\t\t\tdirectories.push(directory);\n\t\t}\n\n\t\t// A path sorts after every prefix of it, so an entry's ancestors have already been kept (or not) by the time it\n\t\t// is checked — and the kept set comes out sorted\n\t\tdirectories.sort();\n\n\t\tconst kept = new Set<string>();\n\t\tfor (const directory of directories) {\n\t\t\tlet beneathKept = false;\n\t\t\tfor (let i = directory.indexOf('/'); i !== -1; i = directory.indexOf('/', i + 1)) {\n\t\t\t\tif (kept.has(directory.substring(0, i))) {\n\t\t\t\t\tbeneathKept = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!beneathKept) {\n\t\t\t\tkept.add(directory);\n\t\t\t}\n\t\t}\n\n\t\treturn [...kept];\n\t}\n\n\tasync getIgnoredEntries(\n\t\trepoPath: string,\n\t\toptions?: { paths?: readonly string[]; priority?: GitCommandPriority },\n\t\tcancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tlet paths = options?.paths;\n\t\t// No pathspec means \"everything\" to git, which is not what an empty list asks for\n\t\tif (paths != null && !paths.length) return [];\n\n\t\t// A scope inside an ignored folder makes git list the folder itself, or fail outright, so a scope that is\n\t\t// itself ignored is answered here, as one entry, and left out of the listing\n\t\tconst scopedEntries = new Set<string>();\n\t\tif (paths != null) {\n\t\t\tconst scopes = [...new Set(paths.map(p => (p.length > 1 ? trimTrailingSlashes(p) : p)))];\n\t\t\tconst ignoredScopes = await this.getIgnoredScopes(\n\t\t\t\trepoPath,\n\t\t\t\tscopes.filter(p => p !== ''),\n\t\t\t\toptions?.priority,\n\t\t\t\tcancellation,\n\t\t\t);\n\n\t\t\tconst ignored = [...ignoredScopes];\n\t\t\t// `lstat`, as git lists a symlink as a file even when it points at a folder\n\t\t\tconst listed = await Promise.allSettled(\n\t\t\t\tignored.map(async scope => {\n\t\t\t\t\tconst fullPath = path.join(repoPath, scope);\n\t\t\t\t\tif (!(await fs.lstat(fullPath)).isDirectory()) return scope;\n\n\t\t\t\t\treturn (await hasNonDirectoryEntry(fullPath)) ? `${scope}/` : undefined;\n\t\t\t\t}),\n\t\t\t);\n\t\t\tfor (const result of listed) {\n\t\t\t\t// Not on disk, so nothing is ignored there\n\t\t\t\tif (result.status === 'fulfilled' && result.value != null) {\n\t\t\t\t\tscopedEntries.add(result.value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpaths = scopes.filter(p => !ignoredScopes.has(p));\n\t\t\tif (!paths.length) return [...scopedEntries].sort();\n\t\t}\n\n\t\t// `status --ignored` walks every ignored tree, and `ls-files --directory` drops the ignored entries inside a\n\t\t// new untracked folder, so status is asked only about those folders\n\t\tconst args = ['ls-files', '-z', '--others', '--exclude-standard', '--directory', '--no-empty-directory'];\n\t\tconst runOptions = {\n\t\t\tcwd: repoPath,\n\t\t\terrors: 'throw',\n\t\t\tcancellation: cancellation,\n\t\t\tpriority: options?.priority,\n\t\t} as const;\n\n\t\tconst readListing = async (extra: readonly string[]): Promise<Set<string>> => {\n\t\t\tconst listed = new Set<string>();\n\t\t\tconst prefix = [...args, ...extra];\n\t\t\tfor (const batch of paths != null ? batchLiteralPathspecs(paths, prefix) : [undefined]) {\n\t\t\t\tconst result = await this._git.run(runOptions, ...prefix, ...(batch != null ? ['--', ...batch] : []));\n\t\t\t\tfor (const entry of iterateByDelimiter(result.stdout, '\\0')) {\n\t\t\t\t\tif (entry !== '') {\n\t\t\t\t\t\tlisted.add(entry);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn listed;\n\t\t};\n\n\t\tconst [ignoredResult, untrackedResult] = await Promise.allSettled([\n\t\t\treadListing(['--ignored']),\n\t\t\treadListing([]),\n\t\t]);\n\t\tif (ignoredResult.status === 'rejected') throw ignoredResult.reason;\n\t\tif (untrackedResult.status === 'rejected') throw untrackedResult.reason;\n\n\t\tconst entries = new Set<string>(scopedEntries);\n\t\tfor (const entry of ignoredResult.value) {\n\t\t\tif (entry !== '.git/') {\n\t\t\t\tentries.add(entry);\n\t\t\t}\n\t\t}\n\n\t\tconst folders: string[] = [];\n\t\tfor (const entry of untrackedResult.value) {\n\t\t\tif (entry.endsWith('/')) {\n\t\t\t\tfolders.push(entry);\n\t\t\t}\n\t\t}\n\t\tif (!folders.length) return [...entries].sort();\n\n\t\t// `matching` reports a folder an ignore rule matches without walking it, but lists each file of a folder that is\n\t\t// ignored only because all of its files are, so `all` untracked files are needed to fold those back\n\t\tconst matching = await this._git.supports('git:status:ignored-matching');\n\t\tconst prefix = [\n\t\t\t'status',\n\t\t\t'--porcelain',\n\t\t\t'-z',\n\t\t\tmatching ? '--ignored=matching' : '--ignored',\n\t\t\tmatching ? '--untracked-files=all' : '--untracked-files=normal',\n\t\t\t'--ignore-submodules=all',\n\t\t];\n\n\t\tconst records: string[] = [];\n\t\tfor (const batch of batchLiteralPathspecs(folders, prefix)) {\n\t\t\tconst listed = await this._git.run(\n\t\t\t\t{\n\t\t\t\t\t...runOptions,\n\t\t\t\t\tconfigs: [...gitConfigsStatus, '-c', 'status.renames=false'],\n\t\t\t\t\tenv: { GIT_OPTIONAL_LOCKS: '0' },\n\t\t\t\t},\n\t\t\t\t...prefix,\n\t\t\t\t'--',\n\t\t\t\t...batch,\n\t\t\t);\n\n\t\t\t// Only untracked folders are in scope, so there are no tracked entries, and no rename pairs, to step over\n\t\t\tfor (const record of iterateByDelimiter(listed.stdout, '\\0')) {\n\t\t\t\tif (matching) {\n\t\t\t\t\trecords.push(record);\n\t\t\t\t} else if (record.startsWith('!! ')) {\n\t\t\t\t\tentries.add(record.substring(3));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (matching) {\n\t\t\tfor (const entry of foldMatchingIgnored(records)) {\n\t\t\t\tentries.add(entry);\n\t\t\t}\n\t\t}\n\t\treturn [...entries].sort();\n\t}\n\n\t/**\n\t * Which of `scopes` are ignored. A scope git refuses (beyond a symlink, inside a submodule) is not ignored, as the\n\t * listing answers it with nothing. Any other failure answers none; when git itself is failing, the listing that\n\t * follows fails too.\n\t */\n\tprivate async getIgnoredScopes(\n\t\trepoPath: string,\n\t\tscopes: readonly string[],\n\t\tpriority: GitCommandPriority | undefined,\n\t\tcancellation: AbortSignal | undefined,\n\t): Promise<Set<string>> {\n\t\ttry {\n\t\t\treturn await this.getIgnoredPaths(repoPath, scopes, { priority: priority }, cancellation);\n\t\t} catch (ex) {\n\t\t\tif (isCancellationError(ex)) throw ex;\n\n\t\t\treturn new Set();\n\t\t}\n\t}\n\n\t/**\n\t * `check-ignore` dies on the first path it can't answer (inside a submodule, beyond a symlink, outside the repository,\n\t * or empty), where this repository ignores nothing, having answered every path before it, so the paths after it are\n\t * asked again, less those in the folder of a path refused for a symlink or submodule, which share its fate. Each path\n\t * is answered once, in one run plus one for each refusal. Any other failure is thrown.\n\t */\n\tasync getIgnoredPaths(\n\t\trepoPath: string,\n\t\tpaths: readonly string[],\n\t\toptions?: { priority?: GitCommandPriority },\n\t\tcancellation?: AbortSignal,\n\t): Promise<Set<string>> {\n\t\tconst ignored = new Set<string>();\n\t\tlet pending = paths;\n\t\twhile (pending.length) {\n\t\t\tconst refused = await this.checkIgnore(repoPath, pending, ignored, options, cancellation);\n\t\t\tif (refused == null) break;\n\n\t\t\tconst folder = refused.folderWide ? getRefusedFolder(pending[refused.index]) : undefined;\n\t\t\tpending = pending.slice(refused.index + 1);\n\t\t\tif (folder != null) {\n\t\t\t\tpending = pending.filter(p => !p.startsWith(folder) || hasDotSegment(p));\n\t\t\t}\n\t\t}\n\t\treturn ignored;\n\t}\n\n\t/**\n\t * One `check-ignore` run over `paths`, adding the ignored ones to `ignored`. Returns the path git died on, which\n\t * every path before it was answered ahead of, or `undefined` when all were answered.\n\t */\n\tprivate async checkIgnore(\n\t\trepoPath: string,\n\t\tpaths: readonly string[],\n\t\tignored: Set<string>,\n\t\toptions: { priority?: GitCommandPriority } | undefined,\n\t\tcancellation: AbortSignal | undefined,\n\t): Promise<{ index: number; folderWide: boolean } | undefined> {\n\t\t// check-ignore reads each line as a pathspec, so a leading `:` would be parsed as magic; `./` makes it a literal path\n\t\tconst lines = paths.map(p => (p.startsWith(':') ? `./${p}` : p));\n\n\t\tlet stdout: string;\n\t\tlet refusal: GitError | undefined;\n\t\ttry {\n\t\t\t// `-v -n` writes a record for every path answered, so the records line up with `paths` and end where git died\n\t\t\tconst result = await this._git.run(\n\t\t\t\t{\n\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\terrors: 'throw',\n\t\t\t\t\tcancellation: cancellation,\n\t\t\t\t\tpriority: options?.priority,\n\t\t\t\t\tstdin: `${lines.join('\\0')}\\0`,\n\t\t\t\t\texpectedExitCodes: [1],\n\t\t\t\t},\n\t\t\t\t'check-ignore',\n\t\t\t\t'-v',\n\t\t\t\t'-n',\n\t\t\t\t'-z',\n\t\t\t\t'--stdin',\n\t\t\t);\n\t\t\tstdout = result.stdout;\n\t\t} catch (ex) {\n\t\t\tif (!(ex instanceof GitError) || ex.stderr == null || !GitErrors.pathspecRefused.test(ex.stderr)) throw ex;\n\n\t\t\trefusal = ex;\n\t\t\tstdout = ex.stdout ?? '';\n\t\t}\n\n\t\t// Each record is source, line number, pattern and path; the pattern is empty when none matched, and `!`-prefixed\n\t\t// when it re-includes the path\n\t\tlet index = 0;\n\t\tlet field = 0;\n\t\tlet matched = false;\n\t\tfor (const value of iterateByDelimiter(stdout, '\\0')) {\n\t\t\tif (field === 2) {\n\t\t\t\tmatched = value.length > 0 && !value.startsWith('!');\n\t\t\t} else if (field === 3) {\n\t\t\t\tif (matched && index < paths.length) {\n\t\t\t\t\tignored.add(paths[index]);\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tfield = (field + 1) % 4;\n\t\t}\n\n\t\tif (refusal == null) return undefined;\n\t\t// Every path answered yet git still died, so the refusal can't be pinned to one of them\n\t\tif (index >= paths.length) throw refusal;\n\n\t\treturn { index: index, folderWide: /is (?:beyond a symbolic link|in submodule)/i.test(refusal.stderr ?? '') };\n\t}\n\n\t/** Every `.gitignore` git reads in the working tree (tracked, or untracked and not itself ignored), root included */\n\tprivate async getGitIgnorePaths(repoPath: string): Promise<string[]> {\n\t\tconst result = await this._git.run(\n\t\t\t{ cwd: repoPath, errors: 'throw' },\n\t\t\t'ls-files',\n\t\t\t'-z',\n\t\t\t'--cached',\n\t\t\t'--others',\n\t\t\t'--exclude-standard',\n\t\t\t'--',\n\t\t\t':(glob)**/.gitignore',\n\t\t);\n\n\t\tconst paths: string[] = [];\n\t\tfor (const line of iterateByDelimiter(result.stdout, '\\0')) {\n\t\t\tif (!line.length) continue;\n\n\t\t\tpaths.push(line);\n\t\t}\n\t\treturn paths;\n\t}\n\n\tprivate async isTrackedWithDetails(\n\t\tfilePath: string,\n\t\trepoPath: string,\n\t\trev?: string,\n\t): Promise<{ path: string; status?: GitFileStatus; originalPath?: string } | undefined> {\n\t\tif (rev === deletedOrMissing) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst [relativePath, root] = splitPath(filePath, repoPath);\n\n\t\t\t// Check if the file exists in the working tree first (better cache reuse)\n\t\t\tlet tracked = await this.revision.exists(root, relativePath);\n\t\t\tif (tracked) return { path: relativePath };\n\n\t\t\t// If a specific revision was provided, check there too\n\t\t\tif (rev && !isUncommitted(rev)) {\n\t\t\t\ttracked = await this.revision.exists(root, relativePath, rev);\n\t\t\t\tif (!tracked) {\n\t\t\t\t\t// Check the parent revision (file might have been deleted in this rev)\n\t\t\t\t\ttracked = await this.revision.exists(root, relativePath, `${rev}^`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn tracked ? { path: relativePath } : undefined;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tthis._unregisterListener.dispose();\n\t\tthis._resetListener.dispose();\n\t\tthis._onDidAnnounceChanges.dispose();\n\t\tthis._indexRefresher.dispose();\n\t\tthis._git.dispose();\n\t\tif (this._cacheOwned) {\n\t\t\tthis._cache.dispose();\n\t\t}\n\t}\n}\n\n/**\n * The names in `refs` a sibling worktree hears with the shared part of `changes`: those of a shared ref kind among\n * `changes`. An empty `changes` or `'unknown'` reaches siblings as every shared kind, unnamed, so none.\n */\nfunction getSharedRefs(changes: readonly RepositoryChange[], refs: readonly string[]): string[] | undefined {\n\tif (!changes.length || changes.includes('unknown')) return undefined;\n\n\tconst shared = refs.filter(r => {\n\t\tif (!r.startsWith('refs/')) return false;\n\n\t\tconst kind = getRefChangeKind(r);\n\t\treturn kind != null && changes.includes(kind) && worktreeSharedChanges.has(kind);\n\t});\n\treturn shared.length ? shared : undefined;\n}\n\n/**\n * Resolves a pathname config value the way git does: a leading `~/` (or a bare `~`) is the home directory, and a\n * relative path is taken from the repository root. Done here rather than with `git config --type=path`, which needs\n * git 2.18, newer than the minimum supported version.\n */\nfunction resolveGitPathConfig(value: string, repoPath: string): string {\n\tif (value === '~' || value.startsWith('~/')) {\n\t\treturn path.join(env.HOME || homedir(), value.substring(1));\n\t}\n\n\treturn path.resolve(repoPath, value);\n}\n\n/** Where git reads global excludes when `core.excludesFile` is unset: `$XDG_CONFIG_HOME/git/ignore`, else `$HOME/.config/git/ignore` */\nfunction getDefaultGlobalExcludesPath(): string | undefined {\n\tconst xdgConfigHome = env.XDG_CONFIG_HOME;\n\tif (xdgConfigHome) return path.join(xdgConfigHome, 'git', 'ignore');\n\n\tconst home = env.HOME || homedir();\n\treturn home ? path.join(home, '.config', 'git', 'ignore') : undefined;\n}\n\n/**\n * The folder of a path git refused for a symlink or submodule in its leading folders, where every other path is refused\n * too; none for a top-level path, or one with `.` or `..` segments, whose folder git would read otherwise\n */\nfunction getRefusedFolder(refused: string): string | undefined {\n\tconst trimmed = trimTrailingSlashes(refused);\n\tif (hasDotSegment(trimmed)) return undefined;\n\n\tconst index = trimmed.lastIndexOf('/');\n\treturn index > 0 ? trimmed.substring(0, index + 1) : undefined;\n}\n\nfunction hasDotSegment(p: string): boolean {\n\treturn /(?:^|\\/)\\.\\.?(?:\\/|$)/.test(p);\n}\n\n/** Whether a folder holds a file or symlink anywhere below it, as git lists no folder without one; an unreadable folder holds none */\nasync function hasNonDirectoryEntry(folder: string): Promise<boolean> {\n\tconst pending = [folder];\n\twhile (pending.length) {\n\t\tconst current = pending.pop()!;\n\t\ttry {\n\t\t\tfor (const entry of await fs.readdir(current, { withFileTypes: true })) {\n\t\t\t\tif (!entry.isDirectory()) return true;\n\n\t\t\t\tpending.push(path.join(current, entry.name));\n\t\t\t}\n\t\t} catch {}\n\t}\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;AAqEtC,IAAa,iBAAb,MAAmD;CAClD,aAA6C;EAAE,IAAI;EAAO,MAAM;EAAO,SAAS;CAAM;CAEtF;CACA;CACA;CAEA;;CAEA;CACA;CACA;;CAEA,wCAAyC,IAAI,IAAwC;CACrF;CACA;CACA;CAEA,YAAY,SAAgC;EAK3C,MAAM,YAAY,QAAQ,QAAQ;EAClC,KAAK,aAAa;EAClB,KAAK,UAAU;GACd,GAAG,QAAQ;GACX,OAAO;IACN,GAAG;IACH,OAAO;KACN,GAAG,WAAW;KACd,UAAU,UAAU,GAAG,UAAU;MAChC,KAAK,OAAO,YAAY,UAAU,GAAG,KAAK;MAC1C,IAAI,sBAAsB,KAAK,GAC9B,KAAK,KAAK,qBAAqB,KAAK,mBAAmB,QAAQ,CAAC;MAEjE,WAAW,OAAO,UAAU,UAAU,GAAG,KAAK;KAC/C;IACD;IACA,YAAY;KACX,GAAG,WAAW;KACd,YAAY,UAAU,SAAS,MAAM,YACpC,KAAK,cAAc,UAAU,SAAS,MAAM;MAC3C,sBAAsB,SAAS;MAC/B,gBAAgB,KAAK,kBAAkB,CAAC,QAAQ,GAAG,OAAO;KAC3D,CAAC;IACH;GACD;EACD;EACA,KAAK,qBAAqB,QAAQ,qBAAqB;EACvD,KAAK,0BAA0B,+BAA+B,QAAQ,sBAAsB;EAC5F,KAAK,OACJ,QAAQ,OACR,IAAI,IAAI,QAAQ,SAAS;GACxB,GAAG,QAAQ;GAGX,WACC,QAAQ,QAAQ,WAAW,aAAa,aAC/B,QAAQ,QA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@ import { DeprecatedGkConfigKeys, GitConfigKeys, GitConfigSubProvider, GitConfigT
|
|
|
7
7
|
import { Git } from "../exec/git.js";
|
|
8
8
|
import { CliGitProviderInternal } from "../cliGitProvider.js";
|
|
9
9
|
//#region ../git-cli/src/providers/config.d.ts
|
|
10
|
+
type RepositoryInfo = {
|
|
11
|
+
repoPath: string;
|
|
12
|
+
gitDir: string;
|
|
13
|
+
commonGitDir: string | undefined;
|
|
14
|
+
superprojectPath: string | undefined;
|
|
15
|
+
} | [safe: true, repoPath: string] | [safe: false] | [];
|
|
10
16
|
/** The clock a failed current-user read's wait is measured on, exported for testing */
|
|
11
17
|
export declare const currentUserReadClock: {
|
|
12
18
|
now: () => number;
|
|
@@ -134,6 +140,7 @@ export declare class ConfigGitSubProvider implements GitConfigSubProvider {
|
|
|
134
140
|
getDefaultWorktreePath(repoPath: string): Promise<string | undefined>;
|
|
135
141
|
getGitDir(repoPath: string): Promise<GitDir>;
|
|
136
142
|
private readGitDir;
|
|
143
|
+
private throwIfClosedSince;
|
|
137
144
|
/**
|
|
138
145
|
* Caches `repoPath`'s git dir when its files show it (see {@link readGitDirsWithoutGit}), never running git; whether
|
|
139
146
|
* one is cached. `false` for a layout only git can answer for (a bare repository, a submodule, a
|
|
@@ -230,12 +237,9 @@ export declare class ConfigGitSubProvider implements GitConfigSubProvider {
|
|
|
230
237
|
* `[]` when git says `cwd` isn't a repository it can use, or `cwd` isn't a folder. Rejects when git gives no answer
|
|
231
238
|
* (it ran past its time limit, was killed or couldn't start), which says nothing about `cwd`.
|
|
232
239
|
*/
|
|
233
|
-
getRepositoryInfo(cwd: string): Promise<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
commonGitDir: string | undefined;
|
|
237
|
-
superprojectPath: string | undefined;
|
|
238
|
-
} | [safe: true, repoPath: string] | [safe: false] | []>;
|
|
240
|
+
getRepositoryInfo(cwd: string): Promise<RepositoryInfo>;
|
|
241
|
+
private getCloseGeneration;
|
|
242
|
+
private readRepositoryInfo;
|
|
239
243
|
/**
|
|
240
244
|
* Ensures the `.git/gk/` folder exists, but only if the parent `.git` directory already exists.
|
|
241
245
|
* This prevents creating stray `.git` directories if the computed path is wrong.
|
|
@@ -395,26 +395,33 @@ var ConfigGitSubProvider = class {
|
|
|
395
395
|
let gitDir;
|
|
396
396
|
const fsGitDirs = await this.readGitDirsWithoutGit(repoPath);
|
|
397
397
|
if (fsGitDirs != null) {
|
|
398
|
+
this.throwIfClosedSince(repoPath, closeGeneration);
|
|
398
399
|
gitDir = toGitDir(fsGitDirs);
|
|
399
|
-
|
|
400
|
+
this.cache.gitDir.set(repoPath, gitDir);
|
|
400
401
|
return gitDir;
|
|
401
402
|
}
|
|
402
403
|
const repoInfo = await this.getRepositoryInfo(repoPath);
|
|
403
|
-
if (!Array.isArray(repoInfo) && repoInfo != null)
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
404
|
+
if (!Array.isArray(repoInfo) && repoInfo != null) {
|
|
405
|
+
this.throwIfClosedSince(repoPath, closeGeneration);
|
|
406
|
+
gitDir = {
|
|
407
|
+
uri: fileUri(repoInfo.gitDir),
|
|
408
|
+
commonUri: repoInfo.commonGitDir ? fileUri(repoInfo.commonGitDir) : void 0,
|
|
409
|
+
parentUri: repoInfo.superprojectPath ? fileUri(repoInfo.superprojectPath) : void 0
|
|
410
|
+
};
|
|
411
|
+
} else {
|
|
409
412
|
gitDir = { uri: this.provider.getAbsoluteUri(joinPaths(repoPath, ".git"), repoPath) };
|
|
410
413
|
if (!this.isTrusted(repoPath)) return gitDir;
|
|
414
|
+
this.throwIfClosedSince(repoPath, closeGeneration);
|
|
411
415
|
const gitDirPath = gitDir.uri.toString(true);
|
|
412
416
|
scope?.warn(`rev-parse failed for '${repoPath}'; falling back to '${gitDirPath}'`);
|
|
413
417
|
this.context.hooks?.operations?.onGitDirResolveFailed?.(repoPath, gitDirPath, `rev_parse returned ${JSON.stringify(repoInfo)}`);
|
|
414
418
|
}
|
|
415
|
-
|
|
419
|
+
this.cache.gitDir.set(repoPath, gitDir);
|
|
416
420
|
return gitDir;
|
|
417
421
|
}
|
|
422
|
+
throwIfClosedSince(repoPath, closeGeneration) {
|
|
423
|
+
if (this.cache.getCloseGeneration(repoPath) !== closeGeneration) throw new Error(`'${repoPath}' was closed while its git dir was read`);
|
|
424
|
+
}
|
|
418
425
|
/**
|
|
419
426
|
* Caches `repoPath`'s git dir when its files show it (see {@link readGitDirsWithoutGit}), never running git; whether
|
|
420
427
|
* one is cached. `false` for a layout only git can answer for (a bare repository, a submodule, a
|
|
@@ -425,7 +432,7 @@ var ConfigGitSubProvider = class {
|
|
|
425
432
|
if (this.cache.gitDir.get(repoPath) != null) return true;
|
|
426
433
|
const closeGeneration = this.cache.getCloseGeneration(repoPath);
|
|
427
434
|
const fsGitDirs = await this.readGitDirsWithoutGit(repoPath, true);
|
|
428
|
-
|
|
435
|
+
this.throwIfClosedSince(repoPath, closeGeneration);
|
|
429
436
|
if (fsGitDirs == null) return false;
|
|
430
437
|
if (this.cache.gitDir.get(repoPath) == null) this.cache.gitDir.set(repoPath, toGitDir(fsGitDirs));
|
|
431
438
|
return true;
|
|
@@ -789,6 +796,25 @@ var ConfigGitSubProvider = class {
|
|
|
789
796
|
* (it ran past its time limit, was killed or couldn't start), which says nothing about `cwd`.
|
|
790
797
|
*/
|
|
791
798
|
async getRepositoryInfo(cwd) {
|
|
799
|
+
const stampedPaths = getPathAndAncestors(cwd);
|
|
800
|
+
const closeGeneration = this.getCloseGeneration(stampedPaths);
|
|
801
|
+
const info = await this.readRepositoryInfo(cwd);
|
|
802
|
+
if (Array.isArray(info)) return info;
|
|
803
|
+
if (!stampedPaths.includes(info.repoPath)) return info;
|
|
804
|
+
if (this.getCloseGeneration(stampedPaths) !== closeGeneration) return info;
|
|
805
|
+
this.cache.gitDir.set(info.repoPath, {
|
|
806
|
+
uri: fileUri(info.gitDir),
|
|
807
|
+
commonUri: info.commonGitDir ? fileUri(info.commonGitDir) : void 0,
|
|
808
|
+
parentUri: info.superprojectPath ? fileUri(info.superprojectPath) : void 0
|
|
809
|
+
});
|
|
810
|
+
return info;
|
|
811
|
+
}
|
|
812
|
+
getCloseGeneration(paths) {
|
|
813
|
+
let generation = 0;
|
|
814
|
+
for (const path of paths) generation += this.cache.getCloseGeneration(path);
|
|
815
|
+
return generation;
|
|
816
|
+
}
|
|
817
|
+
async readRepositoryInfo(cwd) {
|
|
792
818
|
let result;
|
|
793
819
|
if (!this.isTrusted(cwd)) try {
|
|
794
820
|
await promises.stat(joinPaths(cwd, "HEAD"));
|
|
@@ -852,7 +878,7 @@ var ConfigGitSubProvider = class {
|
|
|
852
878
|
const repoPath = result?.commonPath ?? result?.path;
|
|
853
879
|
if (repoPath?.length) {
|
|
854
880
|
const workTree = await this.git.rev_parse__work_tree_of_git_dir(repoPath);
|
|
855
|
-
return workTree ? this.
|
|
881
|
+
return workTree ? this.readRepositoryInfo(workTree) : [true, repoPath];
|
|
856
882
|
}
|
|
857
883
|
}
|
|
858
884
|
}
|
|
@@ -864,7 +890,7 @@ var ConfigGitSubProvider = class {
|
|
|
864
890
|
cwd = parent;
|
|
865
891
|
exists = await fsExists(cwd);
|
|
866
892
|
} while (!exists);
|
|
867
|
-
return this.
|
|
893
|
+
return this.readRepositoryInfo(cwd);
|
|
868
894
|
}
|
|
869
895
|
return emptyArray;
|
|
870
896
|
}
|
|
@@ -996,6 +1022,15 @@ function toGitDir(fsGitDirs) {
|
|
|
996
1022
|
parentUri: void 0
|
|
997
1023
|
};
|
|
998
1024
|
}
|
|
1025
|
+
function getPathAndAncestors(path) {
|
|
1026
|
+
const paths = [];
|
|
1027
|
+
while (true) {
|
|
1028
|
+
paths.push(normalizePath(path));
|
|
1029
|
+
const parent = dirname(path);
|
|
1030
|
+
if (parent === path) return paths;
|
|
1031
|
+
path = parent;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
999
1034
|
//#endregion
|
|
1000
1035
|
export { ConfigGitSubProvider, canonicalizeGitConfigKey, currentUserReadClock, gkConfigFingerprintClock, isGitBooleanFalse, isGkConfigStatRacy, mayConfigDifferByCheckout, parseConfigListing, parseConfigRegexNullOutput, parseConfigRegexOutput, parseGitBoolean };
|
|
1001
1036
|
|