@gitkraken/core-gitlens 0.69.0 → 0.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/git/providers/diff.d.ts +10 -1
  3. package/dist/git/providers/status.d.ts +2 -0
  4. package/dist/git/service.d.ts +5 -1
  5. package/dist/git/service.js +8 -4
  6. package/dist/git/service.js.map +1 -1
  7. package/dist/git/watching/worktreeSummary.d.ts +9 -0
  8. package/dist/git/watching/worktreeSummary.js +17 -5
  9. package/dist/git/watching/worktreeSummary.js.map +1 -1
  10. package/dist/git-cli/cliGitProvider.d.ts +8 -1
  11. package/dist/git-cli/cliGitProvider.js +14 -3
  12. package/dist/git-cli/cliGitProvider.js.map +1 -1
  13. package/dist/git-cli/exec/exec.d.ts +2 -2
  14. package/dist/git-cli/exec/exec.js +2 -2
  15. package/dist/git-cli/exec/git.js +4 -3
  16. package/dist/git-cli/exec/git.js.map +1 -1
  17. package/dist/git-cli/exec/indexRefresh.d.ts +38 -6
  18. package/dist/git-cli/exec/indexRefresh.js +84 -3
  19. package/dist/git-cli/exec/indexRefresh.js.map +1 -1
  20. package/dist/git-cli/providers/diff.d.ts +4 -1
  21. package/dist/git-cli/providers/diff.js +17 -1
  22. package/dist/git-cli/providers/diff.js.map +1 -1
  23. package/dist/git-cli/providers/status.d.ts +4 -0
  24. package/dist/git-cli/providers/status.js +113 -16
  25. package/dist/git-cli/providers/status.js.map +1 -1
  26. package/dist/git-cli/service.d.ts +13 -1
  27. package/dist/git-cli/service.js +1 -0
  28. package/dist/git-cli/service.js.map +1 -1
  29. package/dist/plus/integrations/models/publicIntegration.d.ts +0 -1
  30. package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
  31. package/dist/plus/integrations/reads/drains.d.ts +0 -1
  32. package/dist/utils/env/browser/platform.d.ts +1 -0
  33. package/dist/utils/env/browser/platform.js +4 -1
  34. package/dist/utils/env/browser/platform.js.map +1 -1
  35. package/dist/utils/env/node/exec.d.ts +1 -0
  36. package/dist/utils/env/node/exec.js +9 -3
  37. package/dist/utils/env/node/exec.js.map +1 -1
  38. package/dist/utils/env/node/platform.d.ts +1 -0
  39. package/dist/utils/env/node/platform.js +4 -1
  40. package/dist/utils/env/node/platform.js.map +1 -1
  41. package/dist/utils/platform.d.ts +2 -2
  42. package/dist/utils/platform.js +2 -2
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","names":[],"sources":["../../../../git-cli/src/providers/status.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport type { GitFile } from '@gitlens/git/models/file.js';\nimport { GitFileWorkingTreeStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { GitConflictFile } from '@gitlens/git/models/staging.js';\nimport { GitStatus } from '@gitlens/git/models/status.js';\nimport type { GitStatusFile } from '@gitlens/git/models/statusFile.js';\nimport type { GitStatusSubProvider, GitWorkingChangesState } from '@gitlens/git/providers/status.js';\nimport type { GitCommandPriority, GitErrorHandling } from '@gitlens/git/run.types.js';\nimport { raceWithTimeout } from '@gitlens/utils/cancellation.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { createDisposable } from '@gitlens/utils/disposable.js';\nimport { chunkByStringLength } from '@gitlens/utils/iterable.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { normalizePath, splitPath, stripFolderGlob } from '@gitlens/utils/path.js';\nimport { getSettledValue } from '@gitlens/utils/promise.js';\nimport { PromiseMap } from '@gitlens/utils/promiseCache.js';\nimport { iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { toFsPath } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderInternal } from '../cliGitProvider.js';\nimport type { GitResult } from '../exec/exec.types.js';\nimport type { Git } from '../exec/git.js';\nimport {\n\tdefaultExceptionHandler,\n\tdefaultGitTimeout,\n\tgitConfigsStatus,\n\tGitErrors,\n\tmaxGitCliLength,\n} from '../exec/git.js';\nimport { parseGitConflictFiles } from '../parsers/indexParser.js';\nimport { parseGitStatus } from '../parsers/statusParser.js';\n\n/** Backstop when `advanced.git.timeout` is disabled (0). Independent of the command timeout so disabling it can't\n * also disable deadlock recovery — mirrors `@gate`'s always-on 5-min force-clear. */\nconst disabledTimeoutBackstopMs = 1000 * 60 * 5;\n\n/**\n * Deadlock-backstop duration for a status read (see `dedupeByStatusGeneration`), exported for testing.\n * Always returns a value so a wedged read recovers even with `advanced.git.timeout` disabled (which bounds git\n * *commands*, not deadlock recovery). With a timeout set, `gitTimeout * 2` sits above the per-command timeout so\n * `git.run` reads (and the two streamed presence checks, which are given the same limit) reject at their own timeout\n * first; the backstop's real job is bounding a read that hangs without git's process being the cause.\n */\nexport function computeDeadlockBackstopMs(gitTimeout: number | undefined): number {\n\tconst timeout = gitTimeout ?? defaultGitTimeout;\n\treturn timeout > 0 ? timeout * 2 : disabledTimeoutBackstopMs;\n}\n\n/**\n * A non-default `untracked`/`branch` gets its own key, so a full-status caller never joins a narrower run; the\n * default stays `'getStatus'`, which `getStatusForPathCore`'s rename path joins.\n */\nfunction getStatusReadKey(options?: { untracked?: 'no' | 'normal' | 'all'; branch?: false }): string {\n\tif (options?.untracked == null && options?.branch !== false) return 'getStatus';\n\n\tconst parts: string[] = [];\n\tif (options?.untracked != null) {\n\t\tparts.push(`untracked=${options.untracked}`);\n\t}\n\tif (options?.branch === false) {\n\t\tparts.push('branch=false');\n\t}\n\treturn `getStatus:${parts.join(':')}`;\n}\n\n/**\n * Whether `stream` yields anything, stopping at the first chunk. A stream the time limit killed rejects with the same\n * `CancellationError` a timed-out `git.run` (and the backstop above) reject with.\n */\nasync function hasOutput(stream: AsyncGenerator<string>): Promise<boolean> {\n\t// Unawaited: the stream logs a git error the close rethrows, which must not go unhandled\n\tusing _streamDisposer = createDisposable(() => void stream.return?.(undefined)?.catch(() => {}));\n\n\t// Early exit on first chunk - breaking causes SIGPIPE, killing git process\n\tfor await (const _chunk of stream) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nexport class StatusGitSubProvider implements GitStatusSubProvider {\n\tconstructor(\n\t\tprivate readonly context: GitServiceContext,\n\t\tprivate readonly git: Git,\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: CliGitProviderInternal,\n\t) {}\n\n\t/** In-flight reads, keyed by `<read>\\0<repoPath>\\0<generation>`. `PromiseMap` (not a bare Map) so joiners\n\t * get per-caller cancellation: the shared run aborts only when ALL current callers do. */\n\tprivate readonly _pendingReads = new PromiseMap<string, unknown>();\n\n\t/**\n\t * Single-flight for point-in-time reads of mutable working-tree state — replaces `@gate`, which dedups on\n\t * repoPath with no notion of *when* a run started and so joins a pre-change read to a post-change caller\n\t * (see {@link Cache.getStatusGeneration}). Same-generation callers share one run (via a `PromiseMap`, so a\n\t * joiner cancelling can't reject the others); a caller in a newer generation gets a different key and a\n\t * fresh run; a `force` read advances the clock first, so it fences every later reader too, not just itself.\n\t * The exec-layer command dedup (`Git.pendingCommands`) is fenced automatically: each run carries this entry's\n\t * aggregate signal, whose id is part of the exec cache key, so a newer-generation run never joins an older\n\t * one's process; the generation-derived `correlationKey` is a readable second guard on that key. A `raceWithTimeout` backstop (scaled to `advanced.git.timeout`, see\n\t * {@link computeDeadlockBackstopMs}) replaces `@gate`'s 5-min force-clear so a never-settling read can't wedge\n\t * same-generation callers — including blocking awaiters like the commit flow — indefinitely.\n\t */\n\tprivate dedupeByStatusGeneration<T>(\n\t\trepoPath: string,\n\t\tread: string,\n\t\trun: (correlationKey: string, signal: AbortSignal | undefined) => Promise<T>,\n\t\tcancellation?: AbortSignal,\n\t\tforce?: boolean,\n\t): Promise<T> {\n\t\t// A `force` (user refresh) read is the user asserting the working tree may have changed without the watcher\n\t\t// observing it — the same class of event as a watcher tick, so it ADVANCES the clock rather than carving out\n\t\t// a private key for itself. A one-shot nonce would fence only this caller: the pre-assertion run stays\n\t\t// joinable, so the very next ordinary reader still picks up pre-change content — and, stamped with a newer\n\t\t// `Wip.revision` (assigned at producer start, not read start), applies it right back over the refreshed\n\t\t// result. Advancing is also CHEAPER than a nonce: concurrent readers join the one fresh read instead of each\n\t\t// spawning a private one.\n\t\tif (force) {\n\t\t\tthis.cache.incrementStatusGeneration(repoPath);\n\t\t}\n\t\tconst generation = this.cache.getStatusGeneration(repoPath);\n\t\t// `\\0` separators: `read`/`repoPath` are free-form (paths can contain `:`), so a printable delimiter could\n\t\t// collide (`getStatusForPath:/a:x` vs `getStatusForPath:/a` + `:x`).\n\t\tconst key = `${read}\\0${repoPath}\\0${generation}`;\n\t\tconst correlationKey = `status:${generation}`;\n\t\tconst backstopMs = computeDeadlockBackstopMs(this.git.options.gitTimeout);\n\n\t\treturn this._pendingReads.getOrCreate(\n\t\t\tkey,\n\t\t\t(cacheable, signal) => {\n\t\t\t\t// Point-in-time read: never memoize a settled value. `invalidate()` at the start makes the entry\n\t\t\t\t// self-evict on settle, so a later caller in this same generation re-reads (a newer generation\n\t\t\t\t// already gets a different key). `signal` is the aggregate — the run aborts only if every caller\n\t\t\t\t// cancels, so one caller's abort can't reject the others. The backstop rejects a wedged read so\n\t\t\t\t// waiters unblock and the entry self-evicts; it ALSO aborts the underlying git op (via `backstop`\n\t\t\t\t// linked into the run's signal) so a wedged read releases its GitQueue slot/process rather than\n\t\t\t\t// running orphaned — best-effort, since a truly-stuck process may ignore the abort.\n\t\t\t\tcacheable.invalidate();\n\t\t\t\tconst backstop = new AbortController();\n\t\t\t\tconst runSignal = signal != null ? AbortSignal.any([signal, backstop.signal]) : backstop.signal;\n\t\t\t\treturn raceWithTimeout(run(correlationKey, runSignal), backstopMs, backstop);\n\t\t\t},\n\t\t\tcancellation,\n\t\t) as Promise<T>;\n\t}\n\n\t@debug({ quiet: true })\n\tgetStatus(\n\t\trepoPath: string | undefined,\n\t\toptions?: {\n\t\t\tpriority?: GitCommandPriority;\n\t\t\tforce?: boolean;\n\t\t\tuntracked?: 'no' | 'normal' | 'all';\n\t\t\tbranch?: false;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatus | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\t// `-u` already means `-uall`, so an explicit `'all'` shares the default run\n\t\tconst opts = options?.untracked === 'all' ? { ...options, untracked: undefined } : options;\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\tgetStatusReadKey(opts),\n\t\t\t(correlationKey, signal) =>\n\t\t\t\tthis.getStatusCore(repoPath, { ...opts, correlationKey: correlationKey }, signal),\n\t\t\tcancellation,\n\t\t\topts?.force,\n\t\t);\n\t}\n\n\tprivate async getStatusCore(\n\t\trepoPath: string,\n\t\toptions?: {\n\t\t\tpriority?: GitCommandPriority;\n\t\t\tcorrelationKey?: string;\n\t\t\tuntracked?: 'no' | 'normal' | 'all';\n\t\t\tbranch?: false;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatus | undefined> {\n\t\tconst porcelainVersion = (await this.git.supports('git:status:porcelain-v2')) ? 2 : 1;\n\n\t\tconst result = await this.statusCore(\n\t\t\trepoPath,\n\t\t\tporcelainVersion,\n\t\t\t{\n\t\t\t\tsimilarityThreshold: this.context.config?.commits.similarityThreshold,\n\t\t\t\tpriority: options?.priority,\n\t\t\t\tcorrelationKey: options?.correlationKey,\n\t\t\t\tuntracked: options?.untracked,\n\t\t\t\tbranch: options?.branch,\n\t\t\t\terrors: 'throw',\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t\tconst status = parseGitStatus(result.stdout, repoPath, porcelainVersion);\n\n\t\tif (options?.branch === false) {\n\t\t\t// Without `--branch` a clean tree prints nothing at all, which the parser reads as no status\n\t\t\tif (status == null && result.completion.status === 'exited' && result.exitCode === 0) {\n\t\t\t\treturn new GitStatus(normalizePath(repoPath), '', '', []);\n\t\t\t}\n\t\t\t// No branch name either, which `GitStatus` reads as detached, so there is no paused rebase to look up\n\t\t\treturn status;\n\t\t}\n\n\t\tif (status?.detached) {\n\t\t\tconst pausedOpStatus = await this.provider.pausedOps?.getPausedOperationStatus?.(\n\t\t\t\trepoPath,\n\t\t\t\tundefined,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tif (pausedOpStatus?.type === 'rebase') {\n\t\t\t\treturn new GitStatus(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tpausedOpStatus.incoming.name,\n\t\t\t\t\tstatus.sha,\n\t\t\t\t\tstatus.files,\n\t\t\t\t\tstatus.upstream,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn status;\n\t}\n\n\t@debug({ quiet: true })\n\tasync getStatusForFile(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\toptions?: { renames?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatusFile | undefined> {\n\t\tconst files = await this.getStatusForPathCore(\n\t\t\trepoPath,\n\t\t\ttoFsPath(pathOrUri),\n\t\t\t{ ...options, exact: true },\n\t\t\tcancellation,\n\t\t);\n\t\treturn files?.[0];\n\t}\n\n\t@debug({ quiet: true })\n\tasync getStatusForPath(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\toptions?: { renames?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatusFile[] | undefined> {\n\t\treturn this.getStatusForPathCore(repoPath, toFsPath(pathOrUri), { ...options, exact: false }, cancellation);\n\t}\n\n\tprivate async getStatusForPathCore(\n\t\trepoPath: string,\n\t\tpathOrUri: string,\n\t\toptions: { exact: boolean; renames?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatusFile[] | undefined> {\n\t\tconst relativePath = stripFolderGlob(splitPath(pathOrUri, repoPath)[0]);\n\n\t\t// Rename-aware queries can't scope by pathspec (that disables Git's rename detection), so they run the\n\t\t// SAME full `git status` as `getStatus`. Delegate to it — sharing one process/dedup entry — and filter,\n\t\t// rather than spawning a second identical `git status`.\n\t\tif (options.renames !== false) {\n\t\t\t// The rename path keeps the default handling the scoped read gets\n\t\t\tconst status = await this.getStatus(repoPath, undefined, cancellation).catch((ex: unknown) => {\n\t\t\t\tdefaultExceptionHandler(ex as Error, repoPath);\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t\tif (status == null) return undefined;\n\n\t\t\tif (options.exact) {\n\t\t\t\tconst file = status.files.find(f => f.path === relativePath);\n\t\t\t\treturn file ? [file] : undefined;\n\t\t\t}\n\t\t\treturn status.files.filter(f => f.path.startsWith(relativePath));\n\t\t}\n\n\t\t// Non-rename query: pathspec-scoped `git status` (a distinct command), deduped on its own key. `exact`\n\t\t// is NOT in the key — the pathspec-scoped command is identical for exact/non-exact, so both share one run.\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t// Free-form `relativePath` (may contain `:`) goes LAST so the prefix can't be shifted into it.\n\t\t\t`getStatusForPath:${relativePath}`,\n\t\t\t(correlationKey, signal) => this.getStatusForPathScoped(repoPath, relativePath, correlationKey, signal),\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprivate async getStatusForPathScoped(\n\t\trepoPath: string,\n\t\trelativePath: string,\n\t\tcorrelationKey: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatusFile[] | undefined> {\n\t\tconst porcelainVersion = (await this.git.supports('git:status:porcelain-v2')) ? 2 : 1;\n\t\tconst result = await this.statusCore(\n\t\t\trepoPath,\n\t\t\tporcelainVersion,\n\t\t\t{ similarityThreshold: this.context.config?.commits.similarityThreshold, correlationKey: correlationKey },\n\t\t\tcancellation,\n\t\t\trelativePath,\n\t\t);\n\n\t\tconst status = parseGitStatus(result.stdout, repoPath, porcelainVersion);\n\t\treturn status?.files;\n\t}\n\n\tprivate async statusCore(\n\t\trepoPath: string,\n\t\tporcelainVersion: number = 1,\n\t\toptions?: {\n\t\t\tsimilarityThreshold?: number | null;\n\t\t\tpriority?: GitCommandPriority;\n\t\t\tcorrelationKey?: string;\n\t\t\tuntracked?: 'no' | 'normal' | 'all';\n\t\t\tbranch?: false;\n\t\t\terrors?: GitErrorHandling;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t\t...pathspecs: string[]\n\t): Promise<GitResult> {\n\t\tconst params = ['status', porcelainVersion >= 2 ? `--porcelain=v${porcelainVersion}` : '--porcelain'];\n\t\tif (options?.branch !== false) {\n\t\t\tparams.push('--branch');\n\t\t}\n\t\tparams.push(options?.untracked != null ? `-u${options.untracked}` : '-u');\n\t\tif (await this.git.supports('git:status:find-renames')) {\n\t\t\tparams.push(\n\t\t\t\t`--find-renames${options?.similarityThreshold == null ? '' : `=${options.similarityThreshold}%`}`,\n\t\t\t);\n\t\t}\n\n\t\t// `-z` so a name git would C-quote (`\"`, `\\`, tab, newline) comes as it is on disk\n\t\tparams.push('-z');\n\n\t\treturn this.git.run(\n\t\t\t{\n\t\t\t\tcwd: repoPath,\n\t\t\t\tcancellation: cancellation,\n\t\t\t\tconfigs: gitConfigsStatus,\n\t\t\t\tenv: { GIT_OPTIONAL_LOCKS: '0' },\n\t\t\t\tcorrelationKey: options?.correlationKey,\n\t\t\t\t...(options?.errors != null ? { errors: options.errors } : undefined),\n\t\t\t\t...(options?.priority != null ? { priority: options.priority } : undefined),\n\t\t\t},\n\t\t\t...params,\n\t\t\t'--',\n\t\t\t...pathspecs,\n\t\t);\n\t}\n\n\t@debug({ quiet: true })\n\thasWorkingChanges(\n\t\trepoPath: string,\n\t\toptions?: {\n\t\t\tstaged?: boolean;\n\t\t\tunstaged?: boolean;\n\t\t\tuntracked?: boolean;\n\t\t\tpriority?: GitCommandPriority;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst staged = options?.staged ?? true;\n\t\tconst unstaged = options?.unstaged ?? true;\n\t\tconst untracked = options?.untracked ?? true;\n\t\t// `priority` is in the key even though it doesn't change the answer: a joiner INHERITS the in-flight run's\n\t\t// scheduling. `GitQueue` refuses to start background work while anything is waiting at normal/interactive,\n\t\t// so letting a foreground caller (the overview's dirty pill, the Worktrees view) join a `background` probe\n\t\t// would strand it for the whole graph load. Splitting the two lanes costs at most one extra spawn; joining\n\t\t// costs unbounded foreground latency.\n\t\tconst priority = options?.priority ?? 'default';\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t`hasWorkingChanges:${staged}:${unstaged}:${untracked}:${priority}`,\n\t\t\tasync (correlationKey, signal) => {\n\t\t\t\tif (staged || unstaged) {\n\t\t\t\t\tconst diffConfigs = await this.git.getDiffReadConfigs();\n\t\t\t\t\tconst diffQuiet = (revision: string | undefined) =>\n\t\t\t\t\t\tthis.git.run(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\t\t\t\tconfigs: diffConfigs,\n\t\t\t\t\t\t\t\tcancellation: signal,\n\t\t\t\t\t\t\t\terrors: 'throw',\n\t\t\t\t\t\t\t\texpectedExitCodes: [1],\n\t\t\t\t\t\t\t\tcorrelationKey: correlationKey,\n\t\t\t\t\t\t\t\t...(options?.priority != null ? { priority: options.priority } : undefined),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'diff',\n\t\t\t\t\t\t\t'--quiet',\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\t'--',\n\t\t\t\t\t\t);\n\n\t\t\t\t\tlet result;\n\t\t\t\t\tif (staged && unstaged) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresult = await diffQuiet('HEAD');\n\t\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\t\t// Before the first commit HEAD names nothing; everything staged or modified is a change\n\t\t\t\t\t\t\t// against the empty tree. `diff HEAD --` names only HEAD, so its \"bad revision\" is that case\n\t\t\t\t\t\t\t// without re-validating HEAD (a corrupt HEAD then reads as dirty, the safe answer)\n\t\t\t\t\t\t\tif (GitErrors.badRevision.exec(String(ex))?.[1]?.toUpperCase() !== 'HEAD') throw ex;\n\n\t\t\t\t\t\t\tresult = await diffQuiet(await this.provider.revision.getEmptyTreeSha(repoPath));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult = await diffQuiet(staged ? '--staged' : undefined);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result.exitCode === 1) {\n\t\t\t\t\t\tif (staged && unstaged) {\n\t\t\t\t\t\t\tscope?.addExitInfo('has staged and unstaged changes');\n\t\t\t\t\t\t} else if (staged) {\n\t\t\t\t\t\t\tscope?.addExitInfo('has staged changes');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscope?.addExitInfo('has unstaged changes');\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Check for untracked files. NOTE: this runs through `git.stream`, which spawns directly\n\t\t\t\t// and never enters the queue — so `priority` above doesn't reach it. Only clean worktrees\n\t\t\t\t// get this far (a dirty one already returned above), and callers fanning out across many\n\t\t\t\t// worktrees are expected to bound their own concurrency.\n\t\t\t\tif (untracked) {\n\t\t\t\t\tconst hasUntracked = await this.hasUntrackedFiles(repoPath, signal);\n\t\t\t\t\tif (hasUntracked) {\n\t\t\t\t\t\tscope?.addExitInfo('has untracked files');\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tscope?.addExitInfo('no working changes');\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@debug({ quiet: true })\n\tgetWorkingChangesState(repoPath: string, cancellation?: AbortSignal): Promise<GitWorkingChangesState> {\n\t\tconst scope = getScopedLogger();\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t'getWorkingChangesState',\n\t\t\tasync (correlationKey, signal) => {\n\t\t\t\tconst diffConfigs = await this.git.getDiffReadConfigs();\n\t\t\t\tconst [stagedResult, unstagedResult, untrackedResult] = await Promise.allSettled([\n\t\t\t\t\t// Check for staged changes\n\t\t\t\t\tthis.git.run(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\t\t\tconfigs: diffConfigs,\n\t\t\t\t\t\t\tcancellation: signal,\n\t\t\t\t\t\t\terrors: 'throw',\n\t\t\t\t\t\t\texpectedExitCodes: [1],\n\t\t\t\t\t\t\tcorrelationKey: correlationKey,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'diff',\n\t\t\t\t\t\t'--quiet',\n\t\t\t\t\t\t'--staged',\n\t\t\t\t\t),\n\t\t\t\t\t// Check for unstaged changes\n\t\t\t\t\tthis.git.run(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\t\t\tconfigs: diffConfigs,\n\t\t\t\t\t\t\tcancellation: signal,\n\t\t\t\t\t\t\terrors: 'throw',\n\t\t\t\t\t\t\texpectedExitCodes: [1],\n\t\t\t\t\t\t\tcorrelationKey: correlationKey,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'diff',\n\t\t\t\t\t\t'--quiet',\n\t\t\t\t\t),\n\t\t\t\t\t// Check for untracked files\n\t\t\t\t\tthis.hasUntrackedFiles(repoPath, signal),\n\t\t\t\t]);\n\n\t\t\t\tfor (const settled of [stagedResult, unstagedResult, untrackedResult]) {\n\t\t\t\t\tif (settled.status === 'rejected') throw settled.reason;\n\t\t\t\t}\n\n\t\t\t\tconst result = {\n\t\t\t\t\tstaged: getSettledValue(stagedResult)?.exitCode === 1,\n\t\t\t\t\tunstaged: getSettledValue(unstagedResult)?.exitCode === 1,\n\t\t\t\t\tuntracked: getSettledValue(untrackedResult) === true,\n\t\t\t\t};\n\n\t\t\t\tscope?.addExitInfo(\n\t\t\t\t\tresult.staged || result.unstaged || result.untracked\n\t\t\t\t\t\t? `has ${result.staged ? 'staged' : ''}${result.unstaged ? (result.staged ? ', unstaged' : 'unstaged ') : ''}${\n\t\t\t\t\t\t\t\tresult.untracked ? (result.staged || result.unstaged ? ', untracked' : 'untracked') : ''\n\t\t\t\t\t\t\t} changes`\n\t\t\t\t\t\t: 'no working changes',\n\t\t\t\t);\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\thasConflictingFiles(repoPath: string, cancellation?: AbortSignal): Promise<boolean> {\n\t\t// Route through `dedupeByStatusGeneration` (like every other point-in-time read here) for the join-fence\n\t\t// and the `raceWithTimeout` backstop.\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t'hasConflictingFiles',\n\t\t\tasync (_correlationKey, signal) => {\n\t\t\t\treturn hasOutput(\n\t\t\t\t\tthis.git.stream(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\t\t\tcancellation: signal,\n\t\t\t\t\t\t\ttimeout: this.git.options.gitTimeout ?? defaultGitTimeout,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'ls-files',\n\t\t\t\t\t\t'--unmerged',\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@debug({ quiet: true })\n\tgetConflictingFiles(repoPath: string, cancellation?: AbortSignal): Promise<GitConflictFile[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t'getConflictingFiles',\n\t\t\tasync (correlationKey, signal) => {\n\t\t\t\tconst result = await this.git.run(\n\t\t\t\t\t{ cwd: repoPath, cancellation: signal, errors: 'throw', correlationKey: correlationKey },\n\t\t\t\t\t'ls-files',\n\t\t\t\t\t'-z',\n\t\t\t\t\t'--unmerged',\n\t\t\t\t);\n\n\t\t\t\tif (!result.stdout) {\n\t\t\t\t\tscope?.addExitInfo('no conflicting files');\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst files = parseGitConflictFiles(result.stdout, repoPath);\n\t\t\t\tscope?.addExitInfo(`${String(files.length)} conflicting file(s)`);\n\t\t\t\treturn files;\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprivate async hasUntrackedFiles(repoPath: string, cancellation?: AbortSignal): Promise<boolean> {\n\t\t// An untracked directory is reported as one entry without walking it, and one with nothing reportable\n\t\t// inside is omitted; both keep the answer the same while a huge untracked folder is no longer enumerated\n\t\t// in full. Only where git's directory walk is the reworked one: an older git keeps the full listing\n\t\tconst collapseDirectories = await this.git.supports('git:ls-files:directory');\n\t\treturn hasOutput(\n\t\t\tthis.git.stream(\n\t\t\t\t{\n\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\tcancellation: cancellation,\n\t\t\t\t\ttimeout: this.git.options.gitTimeout ?? defaultGitTimeout,\n\t\t\t\t},\n\t\t\t\t'ls-files',\n\t\t\t\t// '-z', // Unneeded since we are only looking for presence\n\t\t\t\t'--others',\n\t\t\t\t'--exclude-standard',\n\t\t\t\t...(collapseDirectories ? ['--directory', '--no-empty-directory'] : []),\n\t\t\t),\n\t\t);\n\t}\n\n\t@debug({ quiet: true })\n\tgetUntrackedFiles(\n\t\trepoPath: string,\n\t\toptions?: { paths?: readonly string[] },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitFile[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst 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 Promise.resolve([]);\n\n\t\t// Literal pathspecs so a folder named like a glob (`[id]/`) doesn't match its siblings\n\t\tconst pathspecs = paths?.map(p => `:(literal)${p}`);\n\n\t\t// Path-scoped reads join only an identical path set; `\\0` can't appear in a path\n\t\tconst read = pathspecs != null ? `getUntrackedFiles\\0${pathspecs.join('\\0')}` : 'getUntrackedFiles';\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\tread,\n\t\t\tasync (correlationKey, signal) => {\n\t\t\t\tconst prefix = ['ls-files', '-z', '--others', '--exclude-standard'];\n\n\t\t\t\t// Batch the pathspecs to stay under the command-line length limit (a single batch when unscoped).\n\t\t\t\t// Reserve the prefix and a per-arg overhead (separator + possible quoting), so neither a run of\n\t\t\t\t// long paths nor many short ones can push a batch past the OS limit.\n\t\t\t\tlet batches: Iterable<readonly string[]> = [[]];\n\t\t\t\tif (pathspecs != null) {\n\t\t\t\t\tconst perArgOverhead = 3;\n\t\t\t\t\tconst prefixLength = [...prefix, '--'].reduce((sum, arg) => sum + arg.length + perArgOverhead, 0);\n\t\t\t\t\tbatches = chunkByStringLength(pathspecs, maxGitCliLength - prefixLength, perArgOverhead);\n\t\t\t\t}\n\n\t\t\t\tconst seen = new Set<string>();\n\t\t\t\tconst files: GitFile[] = [];\n\n\t\t\t\tfor (const batch of batches) {\n\t\t\t\t\tconst result = await this.git.run(\n\t\t\t\t\t\t{ cwd: repoPath, cancellation: signal, errors: 'throw', correlationKey: correlationKey },\n\t\t\t\t\t\t...prefix,\n\t\t\t\t\t\t...(pathspecs != null ? ['--', ...batch] : []),\n\t\t\t\t\t);\n\n\t\t\t\t\tif (!result.stdout) continue;\n\n\t\t\t\t\tfor (const line of iterateByDelimiter(result.stdout, '\\0')) {\n\t\t\t\t\t\tif (!line.length || seen.has(line)) continue;\n\n\t\t\t\t\t\tseen.add(line);\n\t\t\t\t\t\tfiles.push({ path: line, repoPath: repoPath, status: GitFileWorkingTreeStatus.Untracked });\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tscope?.addExitInfo(files.length ? `${String(files.length)} untracked file(s)` : 'no untracked files');\n\t\t\t\treturn files;\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,4BAA4B;;;;;;;;AASlC,SAAgB,0BAA0B,YAAwC;CACjF,MAAM,UAAU,cAAA;CAChB,OAAO,UAAU,IAAI,UAAU,IAAI;AACpC;;;;;AAMA,SAAS,iBAAiB,SAA2E;CACpG,IAAI,SAAS,a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M,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,oBAAA,IAAA;AA8GrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,qBAAA,IAAA;AA6FrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,0BAAA,IAAA;AAwFrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,uBAAA,IAAA;AAiDrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,qBAAA,IAAA"}
1
+ {"version":3,"file":"status.js","names":[],"sources":["../../../../git-cli/src/providers/status.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport type { GitFile } from '@gitlens/git/models/file.js';\nimport { GitFileWorkingTreeStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { GitConflictFile } from '@gitlens/git/models/staging.js';\nimport { GitStatus } from '@gitlens/git/models/status.js';\nimport type { GitStatusFile } from '@gitlens/git/models/statusFile.js';\nimport type { GitStatusSubProvider, GitWorkingChangesState } from '@gitlens/git/providers/status.js';\nimport type { GitCommandPriority, GitErrorHandling } from '@gitlens/git/run.types.js';\nimport { CancellationError, raceWithTimeout } from '@gitlens/utils/cancellation.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { createDisposable } from '@gitlens/utils/disposable.js';\nimport { chunkByStringLength } from '@gitlens/utils/iterable.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { normalizePath, splitPath, stripFolderGlob } from '@gitlens/utils/path.js';\nimport { getSettledValue } from '@gitlens/utils/promise.js';\nimport { PromiseMap } from '@gitlens/utils/promiseCache.js';\nimport { iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { getRepositoryKey, toFsPath } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderInternal } from '../cliGitProvider.js';\nimport { CancelledRunError, RunError } from '../exec/exec.errors.js';\nimport { withoutTrace2EventLines } from '../exec/exec.js';\nimport type { GitResult } from '../exec/exec.types.js';\nimport type { Git } from '../exec/git.js';\nimport {\n\tdefaultExceptionHandler,\n\tdefaultGitTimeout,\n\tgitConfigsStatus,\n\tGitError,\n\tGitErrors,\n\tmaxGitCliLength,\n} from '../exec/git.js';\nimport { parseGitConflictFiles } from '../parsers/indexParser.js';\nimport { parseGitStatus } from '../parsers/statusParser.js';\n\n/** Backstop when `advanced.git.timeout` is disabled (0). Independent of the command timeout so disabling it can't\n * also disable deadlock recovery — mirrors `@gate`'s always-on 5-min force-clear. */\nconst disabledTimeoutBackstopMs = 1000 * 60 * 5;\n\n/**\n * Deadlock-backstop duration for a status read (see `dedupeByStatusGeneration`), exported for testing.\n * Always returns a value so a wedged read recovers even with `advanced.git.timeout` disabled (which bounds git\n * *commands*, not deadlock recovery). With a timeout set, `gitTimeout * 2` sits above the per-command timeout so\n * `git.run` reads (and the two streamed presence checks, which are given the same limit) reject at their own timeout\n * first; the backstop's real job is bounding a read that hangs without git's process being the cause.\n */\nexport function computeDeadlockBackstopMs(gitTimeout: number | undefined): number {\n\tconst timeout = gitTimeout ?? defaultGitTimeout;\n\treturn timeout > 0 ? timeout * 2 : disabledTimeoutBackstopMs;\n}\n\n/**\n * A non-default `untracked`/`branch` gets its own key, so a full-status caller never joins a narrower run; the\n * default stays `'getStatus'`, which `getStatusForPathCore`'s rename path joins.\n */\nfunction getStatusReadKey(options?: { untracked?: 'no' | 'normal' | 'all'; branch?: false }): string {\n\tif (options?.untracked == null && options?.branch !== false) return 'getStatus';\n\n\tconst parts: string[] = [];\n\tif (options?.untracked != null) {\n\t\tparts.push(`untracked=${options.untracked}`);\n\t}\n\tif (options?.branch === false) {\n\t\tparts.push('branch=false');\n\t}\n\treturn `getStatus:${parts.join(':')}`;\n}\n\ninterface StatusStamp {\n\treadonly generation: number;\n\treadonly closeGeneration: number;\n}\n\nfunction isSameStatusStamp(a: StatusStamp, b: StatusStamp): boolean {\n\treturn a.generation === b.generation && a.closeGeneration === b.closeGeneration;\n}\n\n/**\n * Whether `stream` yields anything, stopping at the first chunk. A stream the time limit killed rejects with the same\n * `CancellationError` a timed-out `git.run` (and the backstop above) reject with.\n */\nasync function hasOutput(stream: AsyncGenerator<string>): Promise<boolean> {\n\t// Unawaited: the stream logs a git error the close rethrows, which must not go unhandled\n\tusing _streamDisposer = createDisposable(() => void stream.return?.(undefined)?.catch(() => {}));\n\n\t// Early exit on first chunk - breaking causes SIGPIPE, killing git process\n\tfor await (const _chunk of stream) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nconst trace2SidRegex = /\"sid\":\"([^\"]+)\"/;\nconst trace2ValueRegex = /\"value\":\"(\\d+)\"/;\n\n// SEE: git 2.56.1 trace2: `refresh/sum_lstat` counts stat misses only after `preload/sum_lstat` (1000+ entries,\n// `core.preloadIndex` on), else every entry; a submodule's status adds its own events under a child `sid`\nfunction parseIndexStatMisses(stderr: string | undefined): number | undefined {\n\tif (!stderr?.includes('\"key\":\"refresh/sum_lstat\"')) return undefined;\n\n\tlet sid: string | undefined;\n\tlet preloaded = false;\n\tfor (const line of iterateByDelimiter(stderr, '\\n')) {\n\t\tconst lineSid = trace2SidRegex.exec(line)?.[1];\n\t\tif (lineSid == null) continue;\n\n\t\tsid ??= lineSid;\n\t\tif (lineSid !== sid) continue;\n\n\t\tif (line.includes('\"key\":\"preload/sum_lstat\"')) {\n\t\t\tpreloaded = true;\n\t\t} else if (line.includes('\"key\":\"refresh/sum_lstat\"')) {\n\t\t\tconst value = trace2ValueRegex.exec(line)?.[1];\n\t\t\treturn preloaded && value != null ? Number(value) : undefined;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction withoutTrace2Events(ex: unknown): unknown {\n\tif (!(ex instanceof GitError) || !(ex.original instanceof RunError) || ex.original instanceof CancelledRunError) {\n\t\treturn ex;\n\t}\n\n\tconst { original } = ex;\n\tconst stderr = withoutTrace2EventLines(original.stderr);\n\treturn new GitError(\n\t\tnew RunError(\n\t\t\t{\n\t\t\t\tmessage: original.message,\n\t\t\t\tcmd: original.cmd,\n\t\t\t\tkilled: original.killed,\n\t\t\t\tcode: original.code,\n\t\t\t\tsignal: original.signal,\n\t\t\t\tsyscall: original.syscall,\n\t\t\t},\n\t\t\toriginal.stdout,\n\t\t\tstderr,\n\t\t),\n\t);\n}\n\nfunction countWorkingTreeChanges(files: readonly GitStatusFile[]): number {\n\tlet count = 0;\n\tfor (const file of files) {\n\t\tconst status = file.workingTreeStatus;\n\t\tif (\n\t\t\tstatus != null &&\n\t\t\tstatus !== GitFileWorkingTreeStatus.Untracked &&\n\t\t\tstatus !== GitFileWorkingTreeStatus.Ignored\n\t\t) {\n\t\t\tcount++;\n\t\t}\n\t}\n\treturn count;\n}\n\nexport class StatusGitSubProvider implements GitStatusSubProvider {\n\tconstructor(\n\t\tprivate readonly context: GitServiceContext,\n\t\tprivate readonly git: Git,\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: CliGitProviderInternal,\n\t) {}\n\n\t/** In-flight reads, keyed by `<read>\\0<repoPath>\\0<generation>`. `PromiseMap` (not a bare Map) so joiners\n\t * get per-caller cancellation: the shared run aborts only when ALL current callers do. */\n\tprivate readonly _pendingReads = new PromiseMap<string, unknown>();\n\tprivate readonly _settledStatuses = new Map<string, { stamp: StatusStamp; status: GitStatus | undefined }>();\n\n\t/**\n\t * Single-flight for point-in-time reads of mutable working-tree state — replaces `@gate`, which dedups on\n\t * repoPath with no notion of *when* a run started and so joins a pre-change read to a post-change caller\n\t * (see {@link Cache.getStatusGeneration}). Same-generation callers share one run (via a `PromiseMap`, so a\n\t * joiner cancelling can't reject the others); a caller in a newer generation gets a different key and a\n\t * fresh run; a `force` read advances the clock first, so it fences every later reader too, not just itself.\n\t * The exec-layer command dedup (`Git.pendingCommands`) is fenced automatically: each run carries this entry's\n\t * aggregate signal, whose id is part of the exec cache key, so a newer-generation run never joins an older\n\t * one's process; the generation-derived `correlationKey` is a readable second guard on that key. A `raceWithTimeout` backstop (scaled to `advanced.git.timeout`, see\n\t * {@link computeDeadlockBackstopMs}) replaces `@gate`'s 5-min force-clear so a never-settling read can't wedge\n\t * same-generation callers — including blocking awaiters like the commit flow — indefinitely.\n\t */\n\tprivate dedupeByStatusGeneration<T>(\n\t\trepoPath: string,\n\t\tread: string,\n\t\trun: (correlationKey: string, signal: AbortSignal | undefined) => Promise<T>,\n\t\tcancellation?: AbortSignal,\n\t\tforce?: boolean,\n\t): Promise<T> {\n\t\t// A `force` (user refresh) read is the user asserting the working tree may have changed without the watcher\n\t\t// observing it — the same class of event as a watcher tick, so it ADVANCES the clock rather than carving out\n\t\t// a private key for itself. A one-shot nonce would fence only this caller: the pre-assertion run stays\n\t\t// joinable, so the very next ordinary reader still picks up pre-change content — and, stamped with a newer\n\t\t// `Wip.revision` (assigned at producer start, not read start), applies it right back over the refreshed\n\t\t// result. Advancing is also CHEAPER than a nonce: concurrent readers join the one fresh read instead of each\n\t\t// spawning a private one.\n\t\tif (force) {\n\t\t\tthis.cache.incrementStatusGeneration(repoPath);\n\t\t}\n\t\tconst generation = this.cache.getStatusGeneration(repoPath);\n\t\t// `\\0` separators: `read`/`repoPath` are free-form (paths can contain `:`), so a printable delimiter could\n\t\t// collide (`getStatusForPath:/a:x` vs `getStatusForPath:/a` + `:x`).\n\t\tconst key = `${read}\\0${repoPath}\\0${generation}`;\n\t\tconst correlationKey = `status:${generation}`;\n\t\tconst backstopMs = computeDeadlockBackstopMs(this.git.options.gitTimeout);\n\n\t\treturn this._pendingReads.getOrCreate(\n\t\t\tkey,\n\t\t\t(cacheable, signal) => {\n\t\t\t\t// Point-in-time read: never memoize a settled value. `invalidate()` at the start makes the entry\n\t\t\t\t// self-evict on settle, so a later caller in this same generation re-reads (a newer generation\n\t\t\t\t// already gets a different key). `signal` is the aggregate — the run aborts only if every caller\n\t\t\t\t// cancels, so one caller's abort can't reject the others. The backstop rejects a wedged read so\n\t\t\t\t// waiters unblock and the entry self-evicts; it ALSO aborts the underlying git op (via `backstop`\n\t\t\t\t// linked into the run's signal) so a wedged read releases its GitQueue slot/process rather than\n\t\t\t\t// running orphaned — best-effort, since a truly-stuck process may ignore the abort.\n\t\t\t\tcacheable.invalidate();\n\t\t\t\tconst backstop = new AbortController();\n\t\t\t\tconst runSignal = signal != null ? AbortSignal.any([signal, backstop.signal]) : backstop.signal;\n\t\t\t\treturn raceWithTimeout(run(correlationKey, runSignal), backstopMs, backstop);\n\t\t\t},\n\t\t\tcancellation,\n\t\t) as Promise<T>;\n\t}\n\n\t@debug({ quiet: true })\n\tgetStatus(\n\t\trepoPath: string | undefined,\n\t\toptions?: {\n\t\t\tpriority?: GitCommandPriority;\n\t\t\tforce?: boolean;\n\t\t\tuntracked?: 'no' | 'normal' | 'all';\n\t\t\tbranch?: false;\n\t\t\treuseGeneration?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatus | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\t// SEE: git-status(1), git 2.56.1: a bare `-u` means `-uall`\n\t\tconst opts = options?.untracked === 'all' ? { ...options, untracked: undefined } : options;\n\t\tconst read = getStatusReadKey(opts);\n\t\tconst repoKey = getRepositoryKey(repoPath);\n\t\tconst settledKey = `${read}\\0${repoKey}`;\n\n\t\tif (opts?.reuseGeneration && !opts.force) {\n\t\t\tif (cancellation?.aborted) return Promise.reject(new CancellationError());\n\n\t\t\tconst settled = this._settledStatuses.get(settledKey);\n\t\t\tif (settled != null) {\n\t\t\t\tif (isSameStatusStamp(settled.stamp, this.getStatusStamp(repoKey))) {\n\t\t\t\t\treturn Promise.resolve(settled.status);\n\t\t\t\t}\n\n\t\t\t\tthis._settledStatuses.delete(settledKey);\n\t\t\t}\n\t\t}\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoKey,\n\t\t\tread,\n\t\t\t(correlationKey, signal) => {\n\t\t\t\tconst stamp = this.getStatusStamp(repoKey);\n\t\t\t\treturn this.getStatusCore(repoPath, { ...opts, correlationKey: correlationKey }, signal).then(\n\t\t\t\t\tstatus => ({ stamp: stamp, status: status, aborted: signal?.aborted === true }),\n\t\t\t\t);\n\t\t\t},\n\t\t\tcancellation,\n\t\t\topts?.force,\n\t\t).then(settled => {\n\t\t\tif (\n\t\t\t\topts?.reuseGeneration &&\n\t\t\t\t!settled.aborted &&\n\t\t\t\tisSameStatusStamp(settled.stamp, this.getStatusStamp(repoKey))\n\t\t\t) {\n\t\t\t\tthis._settledStatuses.set(settledKey, { stamp: settled.stamp, status: settled.status });\n\t\t\t}\n\t\t\treturn settled.status;\n\t\t});\n\t}\n\n\tprivate getStatusStamp(repoKey: string): StatusStamp {\n\t\treturn {\n\t\t\tgeneration: this.cache.getStatusGeneration(repoKey),\n\t\t\tcloseGeneration: this.cache.getCloseGeneration(repoKey),\n\t\t};\n\t}\n\n\tclearSettledStatuses(repoPath?: string): void {\n\t\tif (repoPath == null) {\n\t\t\tthis._settledStatuses.clear();\n\t\t\treturn;\n\t\t}\n\n\t\tconst suffix = `\\0${getRepositoryKey(repoPath)}`;\n\t\tfor (const key of this._settledStatuses.keys()) {\n\t\t\tif (key.endsWith(suffix)) {\n\t\t\t\tthis._settledStatuses.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async getStatusCore(\n\t\trepoPath: string,\n\t\toptions?: {\n\t\t\tpriority?: GitCommandPriority;\n\t\t\tcorrelationKey?: string;\n\t\t\tuntracked?: 'no' | 'normal' | 'all';\n\t\t\tbranch?: false;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatus | undefined> {\n\t\tconst porcelainVersion = (await this.git.supports('git:status:porcelain-v2')) ? 2 : 1;\n\t\tconst indexRefresher = this.provider.indexRefresher;\n\t\tconst traceIndexRefresh = indexRefresher?.afterWrites === true;\n\n\t\tlet result: GitResult;\n\t\ttry {\n\t\t\tresult = await this.statusCore(\n\t\t\t\trepoPath,\n\t\t\t\tporcelainVersion,\n\t\t\t\t{\n\t\t\t\t\tsimilarityThreshold: this.context.config?.commits.similarityThreshold,\n\t\t\t\t\tpriority: options?.priority,\n\t\t\t\t\tcorrelationKey: options?.correlationKey,\n\t\t\t\t\tuntracked: options?.untracked,\n\t\t\t\t\tbranch: options?.branch,\n\t\t\t\t\terrors: 'throw',\n\t\t\t\t\ttraceIndexRefresh: traceIndexRefresh,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tthrow traceIndexRefresh ? withoutTrace2Events(ex) : ex;\n\t\t}\n\t\tconst status = parseGitStatus(result.stdout, repoPath, porcelainVersion);\n\n\t\tif (traceIndexRefresh) {\n\t\t\tconst misses = parseIndexStatMisses(result.stderr);\n\t\t\tif (misses != null) {\n\t\t\t\tindexRefresher.scheduleAfterStaleRead(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tMath.max(0, misses - countWorkingTreeChanges(status?.files ?? [])),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (options?.branch === false) {\n\t\t\tif (status == null && result.completion.status === 'exited' && result.exitCode === 0) {\n\t\t\t\treturn new GitStatus(normalizePath(repoPath), '', '', []);\n\t\t\t}\n\t\t\treturn status;\n\t\t}\n\n\t\tif (status?.detached) {\n\t\t\tconst pausedOpStatus = await this.provider.pausedOps?.getPausedOperationStatus?.(\n\t\t\t\trepoPath,\n\t\t\t\tundefined,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tif (pausedOpStatus?.type === 'rebase') {\n\t\t\t\treturn new GitStatus(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tpausedOpStatus.incoming.name,\n\t\t\t\t\tstatus.sha,\n\t\t\t\t\tstatus.files,\n\t\t\t\t\tstatus.upstream,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn status;\n\t}\n\n\t@debug({ quiet: true })\n\tasync getStatusForFile(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\toptions?: { renames?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatusFile | undefined> {\n\t\tconst files = await this.getStatusForPathCore(\n\t\t\trepoPath,\n\t\t\ttoFsPath(pathOrUri),\n\t\t\t{ ...options, exact: true },\n\t\t\tcancellation,\n\t\t);\n\t\treturn files?.[0];\n\t}\n\n\t@debug({ quiet: true })\n\tasync getStatusForPath(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\toptions?: { renames?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatusFile[] | undefined> {\n\t\treturn this.getStatusForPathCore(repoPath, toFsPath(pathOrUri), { ...options, exact: false }, cancellation);\n\t}\n\n\tprivate async getStatusForPathCore(\n\t\trepoPath: string,\n\t\tpathOrUri: string,\n\t\toptions: { exact: boolean; renames?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatusFile[] | undefined> {\n\t\tconst relativePath = stripFolderGlob(splitPath(pathOrUri, repoPath)[0]);\n\n\t\t// Rename-aware queries can't scope by pathspec (that disables Git's rename detection), so they run the\n\t\t// SAME full `git status` as `getStatus`. Delegate to it — sharing one process/dedup entry — and filter,\n\t\t// rather than spawning a second identical `git status`.\n\t\tif (options.renames !== false) {\n\t\t\t// The rename path keeps the default handling the scoped read gets\n\t\t\tconst status = await this.getStatus(repoPath, undefined, cancellation).catch((ex: unknown) => {\n\t\t\t\tdefaultExceptionHandler(ex as Error, repoPath);\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t\tif (status == null) return undefined;\n\n\t\t\tif (options.exact) {\n\t\t\t\tconst file = status.files.find(f => f.path === relativePath);\n\t\t\t\treturn file ? [file] : undefined;\n\t\t\t}\n\t\t\treturn status.files.filter(f => f.path.startsWith(relativePath));\n\t\t}\n\n\t\t// Non-rename query: pathspec-scoped `git status` (a distinct command), deduped on its own key. `exact`\n\t\t// is NOT in the key — the pathspec-scoped command is identical for exact/non-exact, so both share one run.\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t// Free-form `relativePath` (may contain `:`) goes LAST so the prefix can't be shifted into it.\n\t\t\t`getStatusForPath:${relativePath}`,\n\t\t\t(correlationKey, signal) => this.getStatusForPathScoped(repoPath, relativePath, correlationKey, signal),\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprivate async getStatusForPathScoped(\n\t\trepoPath: string,\n\t\trelativePath: string,\n\t\tcorrelationKey: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitStatusFile[] | undefined> {\n\t\tconst porcelainVersion = (await this.git.supports('git:status:porcelain-v2')) ? 2 : 1;\n\t\tconst result = await this.statusCore(\n\t\t\trepoPath,\n\t\t\tporcelainVersion,\n\t\t\t{ similarityThreshold: this.context.config?.commits.similarityThreshold, correlationKey: correlationKey },\n\t\t\tcancellation,\n\t\t\trelativePath,\n\t\t);\n\n\t\tconst status = parseGitStatus(result.stdout, repoPath, porcelainVersion);\n\t\treturn status?.files;\n\t}\n\n\tprivate async statusCore(\n\t\trepoPath: string,\n\t\tporcelainVersion: number = 1,\n\t\toptions?: {\n\t\t\tsimilarityThreshold?: number | null;\n\t\t\tpriority?: GitCommandPriority;\n\t\t\tcorrelationKey?: string;\n\t\t\tuntracked?: 'no' | 'normal' | 'all';\n\t\t\tbranch?: false;\n\t\t\terrors?: GitErrorHandling;\n\t\t\ttraceIndexRefresh?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t\t...pathspecs: string[]\n\t): Promise<GitResult> {\n\t\tconst params = ['status', porcelainVersion >= 2 ? `--porcelain=v${porcelainVersion}` : '--porcelain'];\n\t\tif (options?.branch !== false) {\n\t\t\tparams.push('--branch');\n\t\t}\n\t\tparams.push(options?.untracked != null ? `-u${options.untracked}` : '-u');\n\t\tif (await this.git.supports('git:status:find-renames')) {\n\t\t\tparams.push(\n\t\t\t\t`--find-renames${options?.similarityThreshold == null ? '' : `=${options.similarityThreshold}%`}`,\n\t\t\t);\n\t\t}\n\n\t\t// SEE: git-status(1), git 2.56.1: without `-z`, a path holding `\"`, `\\`, a tab or a newline comes C-quoted\n\t\tparams.push('-z');\n\n\t\treturn this.git.run(\n\t\t\t{\n\t\t\t\tcwd: repoPath,\n\t\t\t\tcancellation: cancellation,\n\t\t\t\tconfigs: gitConfigsStatus,\n\t\t\t\tenv: options?.traceIndexRefresh\n\t\t\t\t\t? { GIT_OPTIONAL_LOCKS: '0', GIT_TRACE2_EVENT: '1' }\n\t\t\t\t\t: { GIT_OPTIONAL_LOCKS: '0' },\n\t\t\t\tcorrelationKey: options?.correlationKey,\n\t\t\t\t...(options?.errors != null ? { errors: options.errors } : undefined),\n\t\t\t\t...(options?.priority != null ? { priority: options.priority } : undefined),\n\t\t\t},\n\t\t\t...params,\n\t\t\t'--',\n\t\t\t...pathspecs,\n\t\t);\n\t}\n\n\t@debug({ quiet: true })\n\thasWorkingChanges(\n\t\trepoPath: string,\n\t\toptions?: {\n\t\t\tstaged?: boolean;\n\t\t\tunstaged?: boolean;\n\t\t\tuntracked?: boolean;\n\t\t\tpriority?: GitCommandPriority;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst staged = options?.staged ?? true;\n\t\tconst unstaged = options?.unstaged ?? true;\n\t\tconst untracked = options?.untracked ?? true;\n\t\t// `priority` is in the key even though it doesn't change the answer: a joiner INHERITS the in-flight run's\n\t\t// scheduling. `GitQueue` refuses to start background work while anything is waiting at normal/interactive,\n\t\t// so letting a foreground caller (the overview's dirty pill, the Worktrees view) join a `background` probe\n\t\t// would strand it for the whole graph load. Splitting the two lanes costs at most one extra spawn; joining\n\t\t// costs unbounded foreground latency.\n\t\tconst priority = options?.priority ?? 'default';\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t`hasWorkingChanges:${staged}:${unstaged}:${untracked}:${priority}`,\n\t\t\tasync (correlationKey, signal) => {\n\t\t\t\tif (staged || unstaged) {\n\t\t\t\t\tconst diffConfigs = await this.git.getDiffReadConfigs();\n\t\t\t\t\tconst diffQuiet = (revision: string | undefined) =>\n\t\t\t\t\t\tthis.git.run(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\t\t\t\tconfigs: diffConfigs,\n\t\t\t\t\t\t\t\tcancellation: signal,\n\t\t\t\t\t\t\t\terrors: 'throw',\n\t\t\t\t\t\t\t\texpectedExitCodes: [1],\n\t\t\t\t\t\t\t\tcorrelationKey: correlationKey,\n\t\t\t\t\t\t\t\t...(options?.priority != null ? { priority: options.priority } : undefined),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'diff',\n\t\t\t\t\t\t\t'--quiet',\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\t'--',\n\t\t\t\t\t\t);\n\n\t\t\t\t\tlet result;\n\t\t\t\t\tif (staged && unstaged) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresult = await diffQuiet('HEAD');\n\t\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\t\t// Before the first commit HEAD names nothing; everything staged or modified is a change\n\t\t\t\t\t\t\t// against the empty tree. `diff HEAD --` names only HEAD, so its \"bad revision\" is that case\n\t\t\t\t\t\t\t// without re-validating HEAD (a corrupt HEAD then reads as dirty, the safe answer)\n\t\t\t\t\t\t\tif (GitErrors.badRevision.exec(String(ex))?.[1]?.toUpperCase() !== 'HEAD') throw ex;\n\n\t\t\t\t\t\t\tresult = await diffQuiet(await this.provider.revision.getEmptyTreeSha(repoPath));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult = await diffQuiet(staged ? '--staged' : undefined);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result.exitCode === 1) {\n\t\t\t\t\t\tif (staged && unstaged) {\n\t\t\t\t\t\t\tscope?.addExitInfo('has staged and unstaged changes');\n\t\t\t\t\t\t} else if (staged) {\n\t\t\t\t\t\t\tscope?.addExitInfo('has staged changes');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscope?.addExitInfo('has unstaged changes');\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Check for untracked files. NOTE: this runs through `git.stream`, which spawns directly\n\t\t\t\t// and never enters the queue — so `priority` above doesn't reach it. Only clean worktrees\n\t\t\t\t// get this far (a dirty one already returned above), and callers fanning out across many\n\t\t\t\t// worktrees are expected to bound their own concurrency.\n\t\t\t\tif (untracked) {\n\t\t\t\t\tconst hasUntracked = await this.hasUntrackedFiles(repoPath, signal);\n\t\t\t\t\tif (hasUntracked) {\n\t\t\t\t\t\tscope?.addExitInfo('has untracked files');\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tscope?.addExitInfo('no working changes');\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@debug({ quiet: true })\n\tgetWorkingChangesState(repoPath: string, cancellation?: AbortSignal): Promise<GitWorkingChangesState> {\n\t\tconst scope = getScopedLogger();\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t'getWorkingChangesState',\n\t\t\tasync (correlationKey, signal) => {\n\t\t\t\tconst diffConfigs = await this.git.getDiffReadConfigs();\n\t\t\t\tconst [stagedResult, unstagedResult, untrackedResult] = await Promise.allSettled([\n\t\t\t\t\t// Check for staged changes\n\t\t\t\t\tthis.git.run(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\t\t\tconfigs: diffConfigs,\n\t\t\t\t\t\t\tcancellation: signal,\n\t\t\t\t\t\t\terrors: 'throw',\n\t\t\t\t\t\t\texpectedExitCodes: [1],\n\t\t\t\t\t\t\tcorrelationKey: correlationKey,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'diff',\n\t\t\t\t\t\t'--quiet',\n\t\t\t\t\t\t'--staged',\n\t\t\t\t\t),\n\t\t\t\t\t// Check for unstaged changes\n\t\t\t\t\tthis.git.run(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\t\t\tconfigs: diffConfigs,\n\t\t\t\t\t\t\tcancellation: signal,\n\t\t\t\t\t\t\terrors: 'throw',\n\t\t\t\t\t\t\texpectedExitCodes: [1],\n\t\t\t\t\t\t\tcorrelationKey: correlationKey,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'diff',\n\t\t\t\t\t\t'--quiet',\n\t\t\t\t\t),\n\t\t\t\t\t// Check for untracked files\n\t\t\t\t\tthis.hasUntrackedFiles(repoPath, signal),\n\t\t\t\t]);\n\n\t\t\t\tfor (const settled of [stagedResult, unstagedResult, untrackedResult]) {\n\t\t\t\t\tif (settled.status === 'rejected') throw settled.reason;\n\t\t\t\t}\n\n\t\t\t\tconst result = {\n\t\t\t\t\tstaged: getSettledValue(stagedResult)?.exitCode === 1,\n\t\t\t\t\tunstaged: getSettledValue(unstagedResult)?.exitCode === 1,\n\t\t\t\t\tuntracked: getSettledValue(untrackedResult) === true,\n\t\t\t\t};\n\n\t\t\t\tscope?.addExitInfo(\n\t\t\t\t\tresult.staged || result.unstaged || result.untracked\n\t\t\t\t\t\t? `has ${result.staged ? 'staged' : ''}${result.unstaged ? (result.staged ? ', unstaged' : 'unstaged ') : ''}${\n\t\t\t\t\t\t\t\tresult.untracked ? (result.staged || result.unstaged ? ', untracked' : 'untracked') : ''\n\t\t\t\t\t\t\t} changes`\n\t\t\t\t\t\t: 'no working changes',\n\t\t\t\t);\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\thasConflictingFiles(repoPath: string, cancellation?: AbortSignal): Promise<boolean> {\n\t\t// Route through `dedupeByStatusGeneration` (like every other point-in-time read here) for the join-fence\n\t\t// and the `raceWithTimeout` backstop.\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t'hasConflictingFiles',\n\t\t\tasync (_correlationKey, signal) => {\n\t\t\t\treturn hasOutput(\n\t\t\t\t\tthis.git.stream(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\t\t\tcancellation: signal,\n\t\t\t\t\t\t\ttimeout: this.git.options.gitTimeout ?? defaultGitTimeout,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'ls-files',\n\t\t\t\t\t\t'--unmerged',\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@debug({ quiet: true })\n\tgetConflictingFiles(repoPath: string, cancellation?: AbortSignal): Promise<GitConflictFile[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\t'getConflictingFiles',\n\t\t\tasync (correlationKey, signal) => {\n\t\t\t\tconst result = await this.git.run(\n\t\t\t\t\t{ cwd: repoPath, cancellation: signal, errors: 'throw', correlationKey: correlationKey },\n\t\t\t\t\t'ls-files',\n\t\t\t\t\t'-z',\n\t\t\t\t\t'--unmerged',\n\t\t\t\t);\n\n\t\t\t\tif (!result.stdout) {\n\t\t\t\t\tscope?.addExitInfo('no conflicting files');\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst files = parseGitConflictFiles(result.stdout, repoPath);\n\t\t\t\tscope?.addExitInfo(`${String(files.length)} conflicting file(s)`);\n\t\t\t\treturn files;\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprivate async hasUntrackedFiles(repoPath: string, cancellation?: AbortSignal): Promise<boolean> {\n\t\t// An untracked directory is reported as one entry without walking it, and one with nothing reportable\n\t\t// inside is omitted; both keep the answer the same while a huge untracked folder is no longer enumerated\n\t\t// in full. Only where git's directory walk is the reworked one: an older git keeps the full listing\n\t\tconst collapseDirectories = await this.git.supports('git:ls-files:directory');\n\t\treturn hasOutput(\n\t\t\tthis.git.stream(\n\t\t\t\t{\n\t\t\t\t\tcwd: repoPath,\n\t\t\t\t\tcancellation: cancellation,\n\t\t\t\t\ttimeout: this.git.options.gitTimeout ?? defaultGitTimeout,\n\t\t\t\t},\n\t\t\t\t'ls-files',\n\t\t\t\t// '-z', // Unneeded since we are only looking for presence\n\t\t\t\t'--others',\n\t\t\t\t'--exclude-standard',\n\t\t\t\t...(collapseDirectories ? ['--directory', '--no-empty-directory'] : []),\n\t\t\t),\n\t\t);\n\t}\n\n\t@debug({ quiet: true })\n\tgetUntrackedFiles(\n\t\trepoPath: string,\n\t\toptions?: { paths?: readonly string[] },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitFile[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst 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 Promise.resolve([]);\n\n\t\t// Literal pathspecs so a folder named like a glob (`[id]/`) doesn't match its siblings\n\t\tconst pathspecs = paths?.map(p => `:(literal)${p}`);\n\n\t\t// Path-scoped reads join only an identical path set; `\\0` can't appear in a path\n\t\tconst read = pathspecs != null ? `getUntrackedFiles\\0${pathspecs.join('\\0')}` : 'getUntrackedFiles';\n\n\t\treturn this.dedupeByStatusGeneration(\n\t\t\trepoPath,\n\t\t\tread,\n\t\t\tasync (correlationKey, signal) => {\n\t\t\t\tconst prefix = ['ls-files', '-z', '--others', '--exclude-standard'];\n\n\t\t\t\t// Batch the pathspecs to stay under the command-line length limit (a single batch when unscoped).\n\t\t\t\t// Reserve the prefix and a per-arg overhead (separator + possible quoting), so neither a run of\n\t\t\t\t// long paths nor many short ones can push a batch past the OS limit.\n\t\t\t\tlet batches: Iterable<readonly string[]> = [[]];\n\t\t\t\tif (pathspecs != null) {\n\t\t\t\t\tconst perArgOverhead = 3;\n\t\t\t\t\tconst prefixLength = [...prefix, '--'].reduce((sum, arg) => sum + arg.length + perArgOverhead, 0);\n\t\t\t\t\tbatches = chunkByStringLength(pathspecs, maxGitCliLength - prefixLength, perArgOverhead);\n\t\t\t\t}\n\n\t\t\t\tconst seen = new Set<string>();\n\t\t\t\tconst files: GitFile[] = [];\n\n\t\t\t\tfor (const batch of batches) {\n\t\t\t\t\tconst result = await this.git.run(\n\t\t\t\t\t\t{ cwd: repoPath, cancellation: signal, errors: 'throw', correlationKey: correlationKey },\n\t\t\t\t\t\t...prefix,\n\t\t\t\t\t\t...(pathspecs != null ? ['--', ...batch] : []),\n\t\t\t\t\t);\n\n\t\t\t\t\tif (!result.stdout) continue;\n\n\t\t\t\t\tfor (const line of iterateByDelimiter(result.stdout, '\\0')) {\n\t\t\t\t\t\tif (!line.length || seen.has(line)) continue;\n\n\t\t\t\t\t\tseen.add(line);\n\t\t\t\t\t\tfiles.push({ path: line, repoPath: repoPath, status: GitFileWorkingTreeStatus.Untracked });\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tscope?.addExitInfo(files.length ? `${String(files.length)} untracked file(s)` : 'no untracked files');\n\t\t\t\treturn files;\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,4BAA4B;;;;;;;;AASlC,SAAgB,0BAA0B,YAAwC;CACjF,MAAM,UAAU,cAAA;CAChB,OAAO,UAAU,IAAI,UAAU,IAAI;AACpC;;;;;AAMA,SAAS,iBAAiB,SAA2E;CACpG,IAAI,SAAS,aAAa,QAAQ,SAAS,WAAW,OAAO,OAAO;CAEpE,MAAM,QAAkB,CAAC;CACzB,IAAI,SAAS,aAAa,MACzB,MAAM,KAAK,aAAa,QAAQ,WAAW;CAE5C,IAAI,SAAS,WAAW,OACvB,MAAM,KAAK,cAAc;CAE1B,OAAO,aAAa,MAAM,KAAK,GAAG;AACnC;AAOA,SAAS,kBAAkB,GAAgB,GAAyB;CACnE,OAAO,EAAE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AAA,GAAA,qBAAA,WAAA,oBAAA,IAAA;AAiHrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,qBAAA,IAAA;AA6FrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,0BAAA,IAAA;AAwFrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,uBAAA,IAAA;AAiDrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,qBAAA,WAAA,qBAAA,IAAA"}
@@ -32,7 +32,12 @@ export interface CliGitServiceOptions {
32
32
  cache?: CliGitProviderOptions['cache'];
33
33
  /** Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist */
34
34
  ignoredWorktreeFolders?: CliGitProviderOptions['ignoredWorktreeFolders'];
35
- /** Refreshes a checkout's index after core's own writes rewrote it (see `CliGitProviderOptions`); off by default */
35
+ /**
36
+ * Refreshes a checkout's index after core's own writes rewrote it, and once a status read of the whole checkout
37
+ * finds entries git had to re-check, after 2 seconds without another such read, at most once per checkout per 10
38
+ * seconds, and never while a rebase, merge, cherry-pick or revert is paused (see `CliGitProviderOptions`); off by
39
+ * default
40
+ */
36
41
  refreshIndexAfterWrites?: CliGitProviderOptions['refreshIndexAfterWrites'];
37
42
  /**
38
43
  * Filesystem watching provider. When provided, the {@link GitService}
@@ -69,6 +74,13 @@ export interface CliGitServiceOptions {
69
74
  };
70
75
  /** For tests only; production never passes it (see `WorktreeSummaryServiceOptions.verifyBaseRemeasure`) */
71
76
  verifyBaseRemeasure?: WorktreeSummaryServiceOptions['verifyBaseRemeasure'];
77
+ /**
78
+ * Reads a subscribed worktree summary's dirty flag from `getStatus({ untracked: 'normal', reuseGeneration: true })`,
79
+ * for a host that reads that status on every working-tree change (see
80
+ * `WorktreeSummaryServiceOptions.dirtyFromStatus`). The service advances the provider's status clock on the watch
81
+ * service's working-tree changes, as that requires. Off by default.
82
+ */
83
+ summaryDirtyFromStatus?: WorktreeSummaryServiceOptions['dirtyFromStatus'];
72
84
  }
73
85
  /**
74
86
  * Creates a ready-to-use {@link GitService} backed by the CLI git provider.
@@ -49,6 +49,7 @@ function createCliGitService(options) {
49
49
  const service = GitService.createSingleton(options.watchingProvider, {
50
50
  watchPolling: options.watchPolling,
51
51
  verifyBaseRemeasure: options.verifyBaseRemeasure,
52
+ summaryDirtyFromStatus: options.summaryDirtyFromStatus,
52
53
  readFile: (path) => options.context.fs.readFile(fileUri(path)),
53
54
  readDirectory: (path) => options.context.fs.readDirectory(fileUri(path)),
54
55
  disposables: statWorkers != null ? [statWorkers] : void 0
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","names":[],"sources":["../../../git-cli/src/service.ts"],"sourcesContent":["import { readdir, readFile } from 'node:fs/promises';\nimport { env } from 'node:process';\nimport { FileType } from '@gitlens/git/context.js';\nimport { GitService } from '@gitlens/git/service.js';\nimport type { FileWatchingProvider } from '@gitlens/git/watching/provider.js';\nimport { UnwatchedCacheValidator } from '@gitlens/git/watching/unwatchedCacheValidator.js';\nimport { isNotFound } from '@gitlens/git/watching/watchGroup.js';\nimport type { WatchPollingOptions } from '@gitlens/git/watching/watchService.js';\nimport type { WorktreeSummaryServiceOptions } from '@gitlens/git/watching/worktreeSummary.js';\nimport { fileUri } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderOptions } from './cliGitProvider.js';\nimport { CliGitProvider } from './cliGitProvider.js';\nimport type { GitLocation } from './exec/locator.js';\nimport { findGitPath } from './exec/locator.js';\nimport { statLocal, StatWorkerPool } from './exec/statWorkers.js';\n\n/**\n * Options for {@link createCliGitService}.\n */\nexport interface CliGitServiceOptions {\n\t/**\n\t * Path(s) to the git binary.\n\t * Auto-detected if omitted (searches PATH, platform-specific locations).\n\t * Ignored when {@link locator} is provided.\n\t */\n\tgitPath?: string | string[];\n\n\t/**\n\t * Custom git binary resolver. When provided, used instead of the\n\t * default `findGitPath(gitPath)` lookup.\n\t */\n\tlocator?: () => Promise<GitLocation>;\n\n\t/** Host-provided context hooks (cache events, workspace, integrations, telemetry, fs) */\n\tcontext: CliGitProviderOptions['context'];\n\n\t/**\n\t * Git execution options passed through to the underlying Git executor. `gitOptions.isTrusted(repoPath)` is the\n\t * per-repository trust gate: a `false` answer rejects git runs in that path with `WorkspaceUntrustedError` before\n\t * any process starts. It applies only when `context.workspace.isTrusted` is unset; that flag wins when present.\n\t */\n\tgitOptions?: CliGitProviderOptions['gitOptions'];\n\n\t/** Use an existing Cache instance, or one will be created */\n\tcache?: CliGitProviderOptions['cache'];\n\n\t/** Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist */\n\tignoredWorktreeFolders?: CliGitProviderOptions['ignoredWorktreeFolders'];\n\n\t/** Refreshes a checkout's index after core's own writes rewrote it (see `CliGitProviderOptions`); off by default */\n\trefreshIndexAfterWrites?: CliGitProviderOptions['refreshIndexAfterWrites'];\n\n\t/**\n\t * Filesystem watching provider. When provided, the {@link GitService}\n\t * will watch repositories for changes (file creates, edits, deletes).\n\t */\n\twatchingProvider?: FileWatchingProvider;\n\n\t/**\n\t * Polls in place of (or beside) the watchers {@link watchingProvider} reports it can't trust. When omitted, no\n\t * watcher is asked.\n\t */\n\twatchPolling?: WatchPollingOptions;\n\n\t/**\n\t * Keeps the caches that never expire (branches, current branch, refs, tags, remotes, worktrees, stashes, gk config,\n\t * paused operation, and what derives from them) fresh for repositories whose `.git` directory nothing watches:\n\t * before such a read, stats the files a watcher would have reported, and lists the ref directories and worktree\n\t * admin entries, applying what moved as a watcher event would. Files git writes by rename are read only once the\n\t * directory they're in moved, so a read of an idle repository costs a stat per git dir, per ref directory, per\n\t * linked worktree and per file git writes in place, at most once per 250ms per repository; a watched one costs\n\t * nothing, unless its watch is suspended, which holds what it hears until it resumes. Never runs git: a repository\n\t * whose git dir nothing resolved yet is read from its own files, and one whose files can't show it (bare, a\n\t * submodule, `--separate-git-dir`, `core.worktree`) isn't validated until a read resolves it, its files looked at\n\t * again every 30 seconds. What moves in a worktree under an {@link ignoredWorktreeFolders} folder clears nothing. Without a\n\t * {@link watchingProvider}, every repository counts as unwatched. A read waits at most `timeoutMs` (default 1000)\n\t * for the stats, then is served from the cache. Its stats, listings and file reads are made straight on the local\n\t * file system rather than through `context.fs`, and the stats a repository's git dirs need together as one batch\n\t * on a worker thread (on the calling thread while no worker is free). The calls run one at a time per repository\n\t * and two at once overall. A call on a hung mount holds its thread (a worker's, or one of Node's file-system\n\t * threads) until it returns; one outstanding past `timeoutMs` lets other repositories' calls go on, as long as the\n\t * calls hold no more threads than Node's file-system pool has less two (`UV_THREADPOOL_SIZE`, default 4), which\n\t * leaves the host two. Off by default.\n\t */\n\tvalidateUnwatchedCaches?: boolean | { readonly timeoutMs?: number };\n\n\t/** For tests only; production never passes it (see `WorktreeSummaryServiceOptions.verifyBaseRemeasure`) */\n\tverifyBaseRemeasure?: WorktreeSummaryServiceOptions['verifyBaseRemeasure'];\n}\n\n/**\n * Creates a ready-to-use {@link GitService} backed by the CLI git provider.\n *\n * This is the primary entry point for standalone (non-VS Code) consumers\n * of the `@gitlens/git-cli` library. It creates a singleton {@link GitService},\n * wires up a {@link CliGitProvider}, and registers it for all repository paths.\n *\n * @example\n * ```typescript\n * const git = createCliGitService({ context: {} });\n *\n * const repo = git.forRepo('/path/to/repo')!;\n * const branches = await repo.branches.getBranches();\n * const status = await repo.status.getStatus();\n * await repo.ops!.fetch({ remote: 'origin' });\n *\n * git.dispose(); // cleans up provider, cache, and module-level state\n * ```\n *\n * The cache shares a repository's data between its checkouts only once each checkout is registered\n * (`cache.registerRepoPath`). A host that registers checkouts in the background can have each one registered before\n * its first read through `forRepo` by setting a registrar once it has the service (see\n * `Cache.setRepoPathRegistrar`; `undefined` declines a path):\n *\n * ```typescript\n * cache.setRepoPathRegistrar(path =>\n * \tisKnownCheckout(path)\n * \t\t? git.forRepo(path)!.config.getGitDir!().then(gitDir => {\n * \t\t\t\tif (gitDir != null) cache.registerRepoPath(fileUri(path), gitDir);\n * \t\t\t})\n * \t\t: undefined,\n * );\n * ```\n */\nexport function createCliGitService(options: CliGitServiceOptions): GitService {\n\tconst maxFsThreads = getThreadPoolSize() - 2;\n\tconst statWorkers = options.validateUnwatchedCaches ? new StatWorkerPool({ maxWorkers: maxFsThreads }) : undefined;\n\tconst service = GitService.createSingleton(options.watchingProvider, {\n\t\twatchPolling: options.watchPolling,\n\t\tverifyBaseRemeasure: options.verifyBaseRemeasure,\n\t\t// The host's file system reads the shared `.git/config` the watch service compares reports of\n\t\treadFile: path => options.context.fs.readFile(fileUri(path)),\n\t\t// And lists the directory the admin entries of its worktrees are in\n\t\treadDirectory: path => options.context.fs.readDirectory(fileUri(path)),\n\t\tdisposables: statWorkers != null ? [statWorkers] : undefined,\n\t});\n\n\tconst locator = options.locator ?? (() => findGitPath(options.gitPath ?? null));\n\tconst provider = new CliGitProvider({\n\t\tcontext: options.context,\n\t\tlocator: locator,\n\t\tgitOptions: options.gitOptions,\n\t\tcache: options.cache,\n\t\tignoredWorktreeFolders: options.ignoredWorktreeFolders,\n\t\trefreshIndexAfterWrites: options.refreshIndexAfterWrites,\n\t});\n\n\tservice.register(provider, () => true);\n\n\tif (statWorkers != null) {\n\t\tconst validator = new UnwatchedCacheValidator({\n\t\t\tcache: provider.cache,\n\t\t\ttimeoutMs:\n\t\t\t\ttypeof options.validateUnwatchedCaches === 'object'\n\t\t\t\t\t? options.validateUnwatchedCaches.timeoutMs\n\t\t\t\t\t: undefined,\n\t\t\tmaxFsThreads: maxFsThreads,\n\t\t\t// Straight from the local file system, as git reads these paths: a worker thread can't call the host's\n\t\t\t// `context.fs`, and a path read one way must read the same the other, or a batch that failed (whose paths\n\t\t\t// are read one at a time) would report as moved what only read differently. Listings and file reads too, so\n\t\t\t// the validator reads one file system\n\t\t\tstatMany: paths => statWorkers.statMany(paths),\n\t\t\tstat: statLocal,\n\t\t\treadDirectory: async path => {\n\t\t\t\tconst entries = await readdir(path, { withFileTypes: true });\n\t\t\t\treturn entries.map(\n\t\t\t\t\te =>\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\te.name,\n\t\t\t\t\t\t\t(e.isDirectory() ? FileType.Directory : FileType.File) |\n\t\t\t\t\t\t\t\t(e.isSymbolicLink() ? FileType.SymbolicLink : 0),\n\t\t\t\t\t\t] as const,\n\t\t\t\t);\n\t\t\t},\n\t\t\treadFile: async path => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await readFile(path);\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (isNotFound(ex)) return undefined;\n\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Only for a path whose git dir is cached, which it finds the common git dir from without running git\n\t\t\tgetIgnoredWorktreeRoots: repoPath =>\n\t\t\t\tprovider.cache.gitDir.get(repoPath) != null\n\t\t\t\t\t? provider.getIgnoredWorktreeRoots(repoPath)\n\t\t\t\t\t: Promise.resolve([]),\n\t\t\tresolveGitDir: repoPath => provider.config.resolveGitDirWithoutGit(repoPath),\n\t\t\t// The watch service keys repositories as the cache does (`getRepositoryKey` normalizes a file path alike)\n\t\t\tisWatched: repoPath => service.watchService?.isRepoWatched(repoPath) ?? false,\n\t\t});\n\t\tprovider.cache.setReadValidator(\n\t\t\trepoPath => validator.validate(repoPath),\n\t\t\t() => validator.getResourceUsage(),\n\t\t);\n\t\tservice.watchService?.onDidChangeRepoWatched(e => {\n\t\t\tif (e.watched) {\n\t\t\t\tvalidator.onWatched(e.repoPath);\n\t\t\t} else {\n\t\t\t\tvalidator.onUnwatched(e.repoPath);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Advance the provider cache's status generation clock from the watch session's global events — the standalone\n\t// analogue of what the VS Code host wires in `GitProviderService`. Without this, a consumer that passes a\n\t// `watchingProvider` and drives watch sessions gets FS events but a FROZEN clock, so `dedupeByStatusGeneration`\n\t// degrades to the pre-change/post-change stale-join this branch exists to fix. Standalone has no `Repository`\n\t// models, so there are no force-fired `closed`/`lastFetched` bypassing the session for the global repo event to\n\t// miss. Subscriptions are torn down with the service (its `watchService`'s emitters are disposed on dispose).\n\tservice.watchService?.onDidChangeWorkingTree(repoPath => provider.cache.onWorkingTreeChanged(repoPath));\n\t// Announced kinds were evicted when core announced its write; evicting them again would discard what the host\n\t// re-read since\n\tservice.watchService?.onDidChangeRepository(e => {\n\t\tconst changes = e.getUnannouncedChanges();\n\t\tif (changes.length) {\n\t\t\tprovider.cache.onRepositoryChanged(e.repoPath, changes, {\n\t\t\t\tmovedWorktrees: e.movedWorktrees,\n\t\t\t\tobservedAt: e.observedAt,\n\t\t\t});\n\t\t}\n\t});\n\t// FETCH_HEAD maps to no session change, and there's no `Repository` model here to force-fire `lastFetched` (as\n\t// the VS Code host does), so bridge it straight to the cache or the last-fetched time is never re-read.\n\tservice.watchService?.onDidChangeFetchHead(repoPath =>\n\t\tprovider.cache.onRepositoryChanged(repoPath, ['lastFetched']),\n\t);\n\treturn service;\n}\n\n/** The size of libuv's thread pool, which runs Node's file-system calls, as libuv reads it at its first use */\nfunction getThreadPoolSize(): number {\n\tconst size = Number.parseInt(env.UV_THREADPOOL_SIZE ?? '', 10);\n\treturn Number.isNaN(size) ? 4 : Math.min(Math.max(size, 1), 1024);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HA,SAAgB,oBAAoB,SAA2C;CAC9E,MAAM,eAAe,kBAAkB,IAAI;CAC3C,MAAM,cAAc,QAAQ,0BAA0B,IAAI,eAAe,EAAE,YAAY,aAAa,CAAC,IAAI,KAAA;CACzG,MAAM,UAAU,WAAW,gBAAgB,QAAQ,kBAAkB;EACpE,cAAc,QAAQ;EACtB,qBAAqB,QAAQ;EAE7B,WAAU,SAAQ,QAAQ,QAAQ,GAAG,SAAS,QAAQ,IAAI,CAAC;EAE3D,gBAAe,SAAQ,QAAQ,QAAQ,GAAG,cAAc,QAAQ,IAAI,CAAC;EACrE,aAAa,e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,YAAY,EAAE,QAAQ;EAElC,CAAC;CACF;CAQA,QAAQ,cAAc,wBAAuB,aAAY,SAAS,MAAM,qBAAqB,QAAQ,CAAC;CAGtG,QAAQ,cAAc,uBAAsB,MAAK;EAChD,MAAM,UAAU,EAAE,sBAAsB;EACxC,IAAI,QAAQ,QACX,SAAS,MAAM,oBAAoB,EAAE,UAAU,SAAS;GACvD,gBAAgB,EAAE;GAClB,YAAY,EAAE;EACf,CAAC;CAEH,CAAC;CAGD,QAAQ,cAAc,sBAAqB,aAC1C,SAAS,MAAM,oBAAoB,UAAU,CAAC,aAAa,CAAC,CAC7D;CACA,OAAO;AACR;;AAGA,SAAS,oBAA4B;CACpC,MAAM,OAAO,OAAO,SAAS,IAAI,sBAAsB,IAAI,EAAE;CAC7D,OAAO,OAAO,MAAM,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,GAAG,IAAI;AACjE"}
1
+ {"version":3,"file":"service.js","names":[],"sources":["../../../git-cli/src/service.ts"],"sourcesContent":["import { readdir, readFile } from 'node:fs/promises';\nimport { env } from 'node:process';\nimport { FileType } from '@gitlens/git/context.js';\nimport { GitService } from '@gitlens/git/service.js';\nimport type { FileWatchingProvider } from '@gitlens/git/watching/provider.js';\nimport { UnwatchedCacheValidator } from '@gitlens/git/watching/unwatchedCacheValidator.js';\nimport { isNotFound } from '@gitlens/git/watching/watchGroup.js';\nimport type { WatchPollingOptions } from '@gitlens/git/watching/watchService.js';\nimport type { WorktreeSummaryServiceOptions } from '@gitlens/git/watching/worktreeSummary.js';\nimport { fileUri } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderOptions } from './cliGitProvider.js';\nimport { CliGitProvider } from './cliGitProvider.js';\nimport type { GitLocation } from './exec/locator.js';\nimport { findGitPath } from './exec/locator.js';\nimport { statLocal, StatWorkerPool } from './exec/statWorkers.js';\n\n/**\n * Options for {@link createCliGitService}.\n */\nexport interface CliGitServiceOptions {\n\t/**\n\t * Path(s) to the git binary.\n\t * Auto-detected if omitted (searches PATH, platform-specific locations).\n\t * Ignored when {@link locator} is provided.\n\t */\n\tgitPath?: string | string[];\n\n\t/**\n\t * Custom git binary resolver. When provided, used instead of the\n\t * default `findGitPath(gitPath)` lookup.\n\t */\n\tlocator?: () => Promise<GitLocation>;\n\n\t/** Host-provided context hooks (cache events, workspace, integrations, telemetry, fs) */\n\tcontext: CliGitProviderOptions['context'];\n\n\t/**\n\t * Git execution options passed through to the underlying Git executor. `gitOptions.isTrusted(repoPath)` is the\n\t * per-repository trust gate: a `false` answer rejects git runs in that path with `WorkspaceUntrustedError` before\n\t * any process starts. It applies only when `context.workspace.isTrusted` is unset; that flag wins when present.\n\t */\n\tgitOptions?: CliGitProviderOptions['gitOptions'];\n\n\t/** Use an existing Cache instance, or one will be created */\n\tcache?: CliGitProviderOptions['cache'];\n\n\t/** Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist */\n\tignoredWorktreeFolders?: CliGitProviderOptions['ignoredWorktreeFolders'];\n\n\t/**\n\t * Refreshes a checkout's index after core's own writes rewrote it, and once a status read of the whole checkout\n\t * finds entries git had to re-check, after 2 seconds without another such read, at most once per checkout per 10\n\t * seconds, and never while a rebase, merge, cherry-pick or revert is paused (see `CliGitProviderOptions`); off by\n\t * default\n\t */\n\trefreshIndexAfterWrites?: CliGitProviderOptions['refreshIndexAfterWrites'];\n\n\t/**\n\t * Filesystem watching provider. When provided, the {@link GitService}\n\t * will watch repositories for changes (file creates, edits, deletes).\n\t */\n\twatchingProvider?: FileWatchingProvider;\n\n\t/**\n\t * Polls in place of (or beside) the watchers {@link watchingProvider} reports it can't trust. When omitted, no\n\t * watcher is asked.\n\t */\n\twatchPolling?: WatchPollingOptions;\n\n\t/**\n\t * Keeps the caches that never expire (branches, current branch, refs, tags, remotes, worktrees, stashes, gk config,\n\t * paused operation, and what derives from them) fresh for repositories whose `.git` directory nothing watches:\n\t * before such a read, stats the files a watcher would have reported, and lists the ref directories and worktree\n\t * admin entries, applying what moved as a watcher event would. Files git writes by rename are read only once the\n\t * directory they're in moved, so a read of an idle repository costs a stat per git dir, per ref directory, per\n\t * linked worktree and per file git writes in place, at most once per 250ms per repository; a watched one costs\n\t * nothing, unless its watch is suspended, which holds what it hears until it resumes. Never runs git: a repository\n\t * whose git dir nothing resolved yet is read from its own files, and one whose files can't show it (bare, a\n\t * submodule, `--separate-git-dir`, `core.worktree`) isn't validated until a read resolves it, its files looked at\n\t * again every 30 seconds. What moves in a worktree under an {@link ignoredWorktreeFolders} folder clears nothing. Without a\n\t * {@link watchingProvider}, every repository counts as unwatched. A read waits at most `timeoutMs` (default 1000)\n\t * for the stats, then is served from the cache. Its stats, listings and file reads are made straight on the local\n\t * file system rather than through `context.fs`, and the stats a repository's git dirs need together as one batch\n\t * on a worker thread (on the calling thread while no worker is free). The calls run one at a time per repository\n\t * and two at once overall. A call on a hung mount holds its thread (a worker's, or one of Node's file-system\n\t * threads) until it returns; one outstanding past `timeoutMs` lets other repositories' calls go on, as long as the\n\t * calls hold no more threads than Node's file-system pool has less two (`UV_THREADPOOL_SIZE`, default 4), which\n\t * leaves the host two. Off by default.\n\t */\n\tvalidateUnwatchedCaches?: boolean | { readonly timeoutMs?: number };\n\n\t/** For tests only; production never passes it (see `WorktreeSummaryServiceOptions.verifyBaseRemeasure`) */\n\tverifyBaseRemeasure?: WorktreeSummaryServiceOptions['verifyBaseRemeasure'];\n\n\t/**\n\t * Reads a subscribed worktree summary's dirty flag from `getStatus({ untracked: 'normal', reuseGeneration: true })`,\n\t * for a host that reads that status on every working-tree change (see\n\t * `WorktreeSummaryServiceOptions.dirtyFromStatus`). The service advances the provider's status clock on the watch\n\t * service's working-tree changes, as that requires. Off by default.\n\t */\n\tsummaryDirtyFromStatus?: WorktreeSummaryServiceOptions['dirtyFromStatus'];\n}\n\n/**\n * Creates a ready-to-use {@link GitService} backed by the CLI git provider.\n *\n * This is the primary entry point for standalone (non-VS Code) consumers\n * of the `@gitlens/git-cli` library. It creates a singleton {@link GitService},\n * wires up a {@link CliGitProvider}, and registers it for all repository paths.\n *\n * @example\n * ```typescript\n * const git = createCliGitService({ context: {} });\n *\n * const repo = git.forRepo('/path/to/repo')!;\n * const branches = await repo.branches.getBranches();\n * const status = await repo.status.getStatus();\n * await repo.ops!.fetch({ remote: 'origin' });\n *\n * git.dispose(); // cleans up provider, cache, and module-level state\n * ```\n *\n * The cache shares a repository's data between its checkouts only once each checkout is registered\n * (`cache.registerRepoPath`). A host that registers checkouts in the background can have each one registered before\n * its first read through `forRepo` by setting a registrar once it has the service (see\n * `Cache.setRepoPathRegistrar`; `undefined` declines a path):\n *\n * ```typescript\n * cache.setRepoPathRegistrar(path =>\n * \tisKnownCheckout(path)\n * \t\t? git.forRepo(path)!.config.getGitDir!().then(gitDir => {\n * \t\t\t\tif (gitDir != null) cache.registerRepoPath(fileUri(path), gitDir);\n * \t\t\t})\n * \t\t: undefined,\n * );\n * ```\n */\nexport function createCliGitService(options: CliGitServiceOptions): GitService {\n\tconst maxFsThreads = getThreadPoolSize() - 2;\n\tconst statWorkers = options.validateUnwatchedCaches ? new StatWorkerPool({ maxWorkers: maxFsThreads }) : undefined;\n\tconst service = GitService.createSingleton(options.watchingProvider, {\n\t\twatchPolling: options.watchPolling,\n\t\tverifyBaseRemeasure: options.verifyBaseRemeasure,\n\t\tsummaryDirtyFromStatus: options.summaryDirtyFromStatus,\n\t\treadFile: path => options.context.fs.readFile(fileUri(path)),\n\t\treadDirectory: path => options.context.fs.readDirectory(fileUri(path)),\n\t\tdisposables: statWorkers != null ? [statWorkers] : undefined,\n\t});\n\n\tconst locator = options.locator ?? (() => findGitPath(options.gitPath ?? null));\n\tconst provider = new CliGitProvider({\n\t\tcontext: options.context,\n\t\tlocator: locator,\n\t\tgitOptions: options.gitOptions,\n\t\tcache: options.cache,\n\t\tignoredWorktreeFolders: options.ignoredWorktreeFolders,\n\t\trefreshIndexAfterWrites: options.refreshIndexAfterWrites,\n\t});\n\n\tservice.register(provider, () => true);\n\n\tif (statWorkers != null) {\n\t\tconst validator = new UnwatchedCacheValidator({\n\t\t\tcache: provider.cache,\n\t\t\ttimeoutMs:\n\t\t\t\ttypeof options.validateUnwatchedCaches === 'object'\n\t\t\t\t\t? options.validateUnwatchedCaches.timeoutMs\n\t\t\t\t\t: undefined,\n\t\t\tmaxFsThreads: maxFsThreads,\n\t\t\t// KEEP: every read here from the local file system, never `context.fs`: a worker can't call it, and a\n\t\t\t// failed batch re-read one path at a time must read alike or it reports moves that aren't\n\t\t\tstatMany: paths => statWorkers.statMany(paths),\n\t\t\tstat: statLocal,\n\t\t\treadDirectory: async path => {\n\t\t\t\tconst entries = await readdir(path, { withFileTypes: true });\n\t\t\t\treturn entries.map(\n\t\t\t\t\te =>\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\te.name,\n\t\t\t\t\t\t\t(e.isDirectory() ? FileType.Directory : FileType.File) |\n\t\t\t\t\t\t\t\t(e.isSymbolicLink() ? FileType.SymbolicLink : 0),\n\t\t\t\t\t\t] as const,\n\t\t\t\t);\n\t\t\t},\n\t\t\treadFile: async path => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await readFile(path);\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (isNotFound(ex)) return undefined;\n\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\t// KEEP: only for a path whose git dir is cached, so the validator never runs git\n\t\t\tgetIgnoredWorktreeRoots: repoPath =>\n\t\t\t\tprovider.cache.gitDir.get(repoPath) != null\n\t\t\t\t\t? provider.getIgnoredWorktreeRoots(repoPath)\n\t\t\t\t\t: Promise.resolve([]),\n\t\t\tresolveGitDir: repoPath => provider.config.resolveGitDirWithoutGit(repoPath),\n\t\t\tisWatched: repoPath => service.watchService?.isRepoWatched(repoPath) ?? false,\n\t\t});\n\t\tprovider.cache.setReadValidator(\n\t\t\trepoPath => validator.validate(repoPath),\n\t\t\t() => validator.getResourceUsage(),\n\t\t);\n\t\tservice.watchService?.onDidChangeRepoWatched(e => {\n\t\t\tif (e.watched) {\n\t\t\t\tvalidator.onWatched(e.repoPath);\n\t\t\t} else {\n\t\t\t\tvalidator.onUnwatched(e.repoPath);\n\t\t\t}\n\t\t});\n\t}\n\n\t// KEEP: the status clock must advance on every working-tree change, or status reads join and reuse pre-change ones\n\tservice.watchService?.onDidChangeWorkingTree(repoPath => provider.cache.onWorkingTreeChanged(repoPath));\n\t// KEEP: never pass announced changes; evicting them again discards what the host re-read since the announcement\n\tservice.watchService?.onDidChangeRepository(e => {\n\t\tconst changes = e.getUnannouncedChanges();\n\t\tif (changes.length) {\n\t\t\tprovider.cache.onRepositoryChanged(e.repoPath, changes, {\n\t\t\t\tmovedWorktrees: e.movedWorktrees,\n\t\t\t\tobservedAt: e.observedAt,\n\t\t\t});\n\t\t}\n\t});\n\tservice.watchService?.onDidChangeFetchHead(repoPath =>\n\t\tprovider.cache.onRepositoryChanged(repoPath, ['lastFetched']),\n\t);\n\treturn service;\n}\n\n/** The size of libuv's thread pool, which runs Node's file-system calls, as libuv reads it at its first use */\nfunction getThreadPoolSize(): number {\n\tconst size = Number.parseInt(env.UV_THREADPOOL_SIZE ?? '', 10);\n\treturn Number.isNaN(size) ? 4 : Math.min(Math.max(size, 1), 1024);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyIA,SAAgB,oBAAoB,SAA2C;CAC9E,MAAM,eAAe,kBAAkB,IAAI;CAC3C,MAAM,cAAc,QAAQ,0BAA0B,IAAI,eAAe,EAAE,YAAY,aAAa,CAAC,IAAI,KAAA;CACzG,MAAM,UAAU,WAAW,gBAAgB,QAAQ,kBAAkB;EACpE,cAAc,QAAQ;EACtB,qBAAqB,QAAQ;EAC7B,wBAAwB,QAAQ;EAChC,WAAU,SAAQ,QAAQ,QAAQ,GAAG,SAAS,QAAQ,IAAI,CAAC;EAC3D,gBAAe,SAAQ,QAAQ,QAAQ,GAAG,cAAc,QAAQ,IAAI,CAAC;EACrE,aAA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AAU,YAAY,EAAE,QAAQ;EAElC,CAAC;CACF;CAGA,QAAQ,cAAc,wBAAuB,aAAY,SAAS,MAAM,qBAAqB,QAAQ,CAAC;CAEtG,QAAQ,cAAc,uBAAsB,MAAK;EAChD,MAAM,UAAU,EAAE,sBAAsB;EACxC,IAAI,QAAQ,QACX,SAAS,MAAM,oBAAoB,EAAE,UAAU,SAAS;GACvD,gBAAgB,EAAE;GAClB,YAAY,EAAE;EACf,CAAC;CAEH,CAAC;CACD,QAAQ,cAAc,sBAAqB,aAC1C,SAAS,MAAM,oBAAoB,UAAU,CAAC,aAAa,CAAC,CAC7D;CACA,OAAO;AACR;;AAGA,SAAS,oBAA4B;CACpC,MAAM,OAAO,OAAO,SAAS,IAAI,sBAAsB,IAAI,EAAE;CAC7D,OAAO,OAAO,MAAM,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,GAAG,IAAI;AACjE"}
@@ -10,7 +10,6 @@ import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
10
10
  import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
11
11
  import { GitCloudHostIntegrationId, IntegrationIds, IssuesCloudHostIntegrationId, IssuesHostIntegrationIds } from "../constants.js";
12
12
  import { Sources } from "../telemetry.js";
13
- import "../providerFilters.js";
14
13
  import { ProviderRepositoryShape } from "../results.js";
15
14
  import { ProviderRepositoriesInput } from "../manager.js";
16
15
  //#region ../plus/integrations/src/models/publicIntegration.d.ts
@@ -1,5 +1,4 @@
1
1
  import { IssueSorting } from "../../../git/models/issue.js";
2
- import "../providerFilters.js";
3
2
  //#region ../plus/integrations/src/providers/issueSorts.d.ts
4
3
  /** GitHub and GHE: one `search` channel serves all three issue reads, so all three order the same way. */
5
4
  export declare const githubIssueSorts: IssueSorting[];
@@ -1,7 +1,6 @@
1
1
  import { ResourceDescriptor } from "../../../git/models/resourceDescriptor.js";
2
2
  import { PullRequest, PullRequestFilter, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
3
3
  import { IntegrationIds } from "../constants.js";
4
- import "../providerFilters.js";
5
4
  import { ProviderWarning } from "../results.js";
6
5
  import { ProviderSweepTarget, PullRequestSweepOptions } from "../manager.js";
7
6
  import { IntegrationResult } from "../models/publicIntegration.js";
@@ -2,6 +2,7 @@
2
2
  export declare const isWindows: boolean;
3
3
  export declare const isLinux: boolean;
4
4
  export declare const isMac: boolean;
5
+ export declare function getAltKeySymbol(): string;
5
6
  export declare function getShiftKeySymbol(): string;
6
7
  //#endregion
7
8
  //# sourceMappingURL=platform.d.ts.map
@@ -4,10 +4,13 @@ const _userAgent = typeof navigator !== "undefined" ? navigator.userAgent : "";
4
4
  const isWindows = _platform === "Windows" || _userAgent.includes("Windows");
5
5
  const isLinux = _platform === "Linux" || _userAgent.includes("Linux");
6
6
  const isMac = _platform === "macOS" || _userAgent.includes("Macintosh");
7
+ function getAltKeySymbol() {
8
+ return isMac ? "⌥" : "Alt";
9
+ }
7
10
  function getShiftKeySymbol() {
8
11
  return isMac ? "⇧" : "Shift";
9
12
  }
10
13
  //#endregion
11
- export { getShiftKeySymbol, isLinux, isMac, isWindows };
14
+ export { getAltKeySymbol, getShiftKeySymbol, isLinux, isMac, isWindows };
12
15
 
13
16
  //# sourceMappingURL=platform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","names":[],"sources":["../../../../../utils/src/env/browser/platform.ts"],"sourcesContent":["declare const navigator: { userAgent: string; userAgentData?: { platform?: string } } | undefined;\n\nconst _platform: string | undefined = (\n\tglobalThis as unknown as { navigator?: { userAgentData?: { platform?: string } } }\n).navigator?.userAgentData?.platform;\nconst _userAgent: string = typeof navigator !== 'undefined' ? navigator.userAgent : '';\n\nexport const isWindows: boolean = _platform === 'Windows' || _userAgent.includes('Windows');\nexport const isLinux: boolean = _platform === 'Linux' || _userAgent.includes('Linux');\nexport const isMac: boolean = _platform === 'macOS' || _userAgent.includes('Macintosh');\n\nexport function getShiftKeySymbol(): string {\n\treturn isMac ? '⇧' : 'Shift';\n}\n"],"mappings":";AAEA,MAAM,YACL,WACC,WAAW,eAAe;AAC5B,MAAM,aAAqB,OAAO,cAAc,cAAc,UAAU,YAAY;AAEpF,MAAa,YAAqB,cAAc,aAAa,WAAW,SAAS,SAAS;AAC1F,MAAa,UAAmB,cAAc,WAAW,WAAW,SAAS,OAAO;AACpF,MAAa,QAAiB,cAAc,WAAW,WAAW,SAAS,WAAW;AAEtF,SAAgB,oBAA4B;CAC3C,OAAO,QAAQ,MAAM;AACtB"}
1
+ {"version":3,"file":"platform.js","names":[],"sources":["../../../../../utils/src/env/browser/platform.ts"],"sourcesContent":["declare const navigator: { userAgent: string; userAgentData?: { platform?: string } } | undefined;\n\nconst _platform: string | undefined = (\n\tglobalThis as unknown as { navigator?: { userAgentData?: { platform?: string } } }\n).navigator?.userAgentData?.platform;\nconst _userAgent: string = typeof navigator !== 'undefined' ? navigator.userAgent : '';\n\nexport const isWindows: boolean = _platform === 'Windows' || _userAgent.includes('Windows');\nexport const isLinux: boolean = _platform === 'Linux' || _userAgent.includes('Linux');\nexport const isMac: boolean = _platform === 'macOS' || _userAgent.includes('Macintosh');\n\nexport function getAltKeySymbol(): string {\n\treturn isMac ? '⌥' : 'Alt';\n}\n\nexport function getShiftKeySymbol(): string {\n\treturn isMac ? '⇧' : 'Shift';\n}\n"],"mappings":";AAEA,MAAM,YACL,WACC,WAAW,eAAe;AAC5B,MAAM,aAAqB,OAAO,cAAc,cAAc,UAAU,YAAY;AAEpF,MAAa,YAAqB,cAAc,aAAa,WAAW,SAAS,SAAS;AAC1F,MAAa,UAAmB,cAAc,WAAW,WAAW,SAAS,OAAO;AACpF,MAAa,QAAiB,cAAc,WAAW,WAAW,SAAS,WAAW;AAEtF,SAAgB,kBAA0B;CACzC,OAAO,QAAQ,MAAM;AACtB;AAEA,SAAgB,oBAA4B;CAC3C,OAAO,QAAQ,MAAM;AACtB"}
@@ -125,6 +125,7 @@ export interface RunOptions<TEncoding = BufferEncoding | 'buffer'> {
125
125
  /** Launches the process; defaults to {@link spawnProcess}. Only used by `runSpawn` */
126
126
  readonly spawn?: ProcessSpawner;
127
127
  }
128
+ export declare function withoutTrace2EventLines(text: string): string;
128
129
  type ExitCodeOnlyRunOptions<TEncoding = BufferEncoding | 'buffer'> = RunOptions<TEncoding> & {
129
130
  exitCodeOnly: true;
130
131
  };
@@ -235,6 +235,10 @@ function killTreeOnKill(child) {
235
235
  };
236
236
  }
237
237
  const bufferExceededRegex = /stdout maxBuffer( length)? exceeded/;
238
+ function withoutTrace2EventLines(text) {
239
+ if (!text.includes("{\"event\":")) return text;
240
+ return text.split("\n").filter((line) => !line.startsWith("{\"event\":")).join("\n");
241
+ }
238
242
  function run(command, args, encoding, options) {
239
243
  const scope = getScopedLogger() ?? maybeStartScopedLogger("Exec.run");
240
244
  const { stdin, stdinEncoding, cancellation, decode, ...opts } = {
@@ -392,7 +396,8 @@ function runSpawn(command, args, encoding, options) {
392
396
  if (code !== 0 || signal) {
393
397
  const stdio = getStdio(errorEncoding);
394
398
  const { stdout, stderr } = stdio instanceof Promise ? await stdio : stdio;
395
- if (stderr.length && !options?.quiet && scope?.enabled("debug")) scope?.warn(`[EXEC] '${command} ${args.join(" ")}' \u2022 ${stderr}`);
399
+ const loggedStderr = !options?.quiet && scope?.enabled("debug") ? withoutTrace2EventLines(stderr) : void 0;
400
+ if (loggedStderr) scope?.warn(`[EXEC] '${command} ${args.join(" ")}' \u2022 ${loggedStderr}`);
396
401
  if (signal === "SIGTERM") {
397
402
  reject(new CancelledRunError(`${command} ${args.join(" ")}`, true, code ?? void 0, signal, proc.killed ? "timeout" : "unknown"));
398
403
  return;
@@ -406,7 +411,8 @@ function runSpawn(command, args, encoding, options) {
406
411
  }
407
412
  const stdio = getStdio(encoding);
408
413
  const { stdout, stderr } = stdio instanceof Promise ? await stdio : stdio;
409
- if (stderr.length && !options?.quiet && scope?.enabled("debug")) scope?.warn(`[EXEC] '${command} ${args.join(" ")}' \u2022 ${typeof stderr === "string" ? stderr : stderr.toString()}`);
414
+ const loggedStderr = stderr.length && !options?.quiet && scope?.enabled("debug") ? withoutTrace2EventLines(typeof stderr === "string" ? stderr : stderr.toString()) : void 0;
415
+ if (loggedStderr) scope?.warn(`[EXEC] '${command} ${args.join(" ")}' \u2022 ${loggedStderr}`);
410
416
  resolve({
411
417
  exitCode: code ?? void 0,
412
418
  signal: signal ?? void 0,
@@ -422,6 +428,6 @@ async function fsExists(path) {
422
428
  return new Promise((resolve) => access(path, constants.F_OK, (err) => resolve(err == null)));
423
429
  }
424
430
  //#endregion
425
- export { CancelledRunError, RunError, endStdin, findExecutable, fsExists, run, runSpawn, spawnProcess };
431
+ export { CancelledRunError, RunError, endStdin, findExecutable, fsExists, run, runSpawn, spawnProcess, withoutTrace2EventLines };
426
432
 
427
433
  //# sourceMappingURL=exec.js.map