@gitkraken/core-gitlens 0.15.4 → 0.15.6

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 (61) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/dist/git/cache.d.ts +9 -12
  3. package/dist/git/cache.js +34 -16
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/context.d.ts +19 -2
  6. package/dist/git/context.js.map +1 -1
  7. package/dist/git/providers/provider.d.ts +7 -0
  8. package/dist/git/service.d.ts +5 -1
  9. package/dist/git/service.js +8 -4
  10. package/dist/git/service.js.map +1 -1
  11. package/dist/git/watching/changeEvent.d.ts +25 -1
  12. package/dist/git/watching/changeEvent.js +36 -2
  13. package/dist/git/watching/changeEvent.js.map +1 -1
  14. package/dist/git/watching/configSections.d.ts +35 -0
  15. package/dist/git/watching/configSections.js +210 -0
  16. package/dist/git/watching/configSections.js.map +1 -0
  17. package/dist/git/watching/watchGroup.d.ts +36 -3
  18. package/dist/git/watching/watchGroup.js +107 -2
  19. package/dist/git/watching/watchGroup.js.map +1 -1
  20. package/dist/git/watching/watchService.d.ts +14 -3
  21. package/dist/git/watching/watchService.js +10 -7
  22. package/dist/git/watching/watchService.js.map +1 -1
  23. package/dist/git/watching/watchSession.d.ts +52 -21
  24. package/dist/git/watching/watchSession.js +164 -42
  25. package/dist/git/watching/watchSession.js.map +1 -1
  26. package/dist/git/watching/worktreeSummary.d.ts +9 -7
  27. package/dist/git/watching/worktreeSummary.js +21 -10
  28. package/dist/git/watching/worktreeSummary.js.map +1 -1
  29. package/dist/git-cli/cliGitProvider.d.ts +6 -1
  30. package/dist/git-cli/cliGitProvider.js +45 -5
  31. package/dist/git-cli/cliGitProvider.js.map +1 -1
  32. package/dist/git-cli/providers/branches.d.ts +2 -2
  33. package/dist/git-cli/providers/branches.js +17 -15
  34. package/dist/git-cli/providers/branches.js.map +1 -1
  35. package/dist/git-cli/providers/config.d.ts +13 -0
  36. package/dist/git-cli/providers/config.js +38 -1
  37. package/dist/git-cli/providers/config.js.map +1 -1
  38. package/dist/git-cli/providers/operations.d.ts +35 -1
  39. package/dist/git-cli/providers/operations.js +175 -16
  40. package/dist/git-cli/providers/operations.js.map +1 -1
  41. package/dist/git-cli/providers/stash.d.ts +1 -0
  42. package/dist/git-cli/providers/stash.js +9 -3
  43. package/dist/git-cli/providers/stash.js.map +1 -1
  44. package/dist/git-cli/providers/worktrees.js +11 -4
  45. package/dist/git-cli/providers/worktrees.js.map +1 -1
  46. package/dist/git-cli/service.js +5 -1
  47. package/dist/git-cli/service.js.map +1 -1
  48. package/dist/plus/integrations/collectionMetadata.js +4 -2
  49. package/dist/plus/integrations/collectionMetadata.js.map +1 -1
  50. package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
  51. package/dist/plus/integrations/providers/providerErrors.d.ts +22 -0
  52. package/dist/plus/integrations/providers/providerErrors.js +43 -2
  53. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  54. package/dist/plus/integrations/providers/providersApi.js +12 -8
  55. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  56. package/dist/plus/integrations/reads/drains.d.ts +0 -1
  57. package/dist/plus/integrations/results.d.ts +13 -3
  58. package/dist/plus/integrations/results.js +12 -2
  59. package/dist/plus/integrations/results.js.map +1 -1
  60. package/docs/integrations.md +14 -0
  61. package/package.json +1 -1
@@ -46,6 +46,13 @@ export declare function canonicalizeGitConfigKey(key: string): string;
46
46
  export declare function parseConfigRegexOutput(data: string | undefined, options?: {
47
47
  includeValueless?: boolean;
48
48
  }): Map<string, string>;
49
+ /**
50
+ * Parses `git config --null --get-regexp` output into every value of each key, in the order git printed them. Each
51
+ * entry is its key, a newline and its value, ended by a NUL, so a value may hold newlines or spaces unambiguously.
52
+ * A valueless entry (`key`, no `=`), which git prints with no newline, is skipped, as {@link parseConfigRegexOutput}
53
+ * skips it by default.
54
+ */
55
+ export declare function parseConfigRegexNullOutput(data: string | undefined): Map<string, string[]>;
49
56
  export declare function parseGitBoolean(value: string | undefined): boolean;
50
57
  /** Whether a git config value spells boolean-false (`false`/`no`/`off`/`0`/empty), per git's maybe-bool parsing. */
51
58
  export declare function isGitBooleanFalse(value: string): boolean;
@@ -79,6 +86,12 @@ export declare class ConfigGitSubProvider implements GitConfigSubProvider {
79
86
  global?: boolean;
80
87
  runGitLocally?: boolean;
81
88
  }): Promise<Map<string, string>>;
89
+ /**
90
+ * Every value of each key matching `pattern` (`git config --get-regexp`), for a key git lets repeat, like
91
+ * `remote.<name>.fetch`: {@link getConfigRegex} keeps only each key's last value. Cached beside it, so the same
92
+ * writes and config changes clear it. Rejects when git couldn't read the configuration.
93
+ */
94
+ getConfigRegexAll(repoPath: string, pattern: string): Promise<Map<string, string[]>>;
82
95
  private getConfigRegexCore;
83
96
  setConfig(repoPath: string | undefined, key: GitConfigKeys, value: string | undefined, options?: {
84
97
  file?: string;
@@ -111,6 +111,26 @@ function parseConfigRegexOutput(data, options) {
111
111
  }
112
112
  return configMap;
113
113
  }
114
+ /**
115
+ * Parses `git config --null --get-regexp` output into every value of each key, in the order git printed them. Each
116
+ * entry is its key, a newline and its value, ended by a NUL, so a value may hold newlines or spaces unambiguously.
117
+ * A valueless entry (`key`, no `=`), which git prints with no newline, is skipped, as {@link parseConfigRegexOutput}
118
+ * skips it by default.
119
+ */
120
+ function parseConfigRegexNullOutput(data) {
121
+ const configMap = /* @__PURE__ */ new Map();
122
+ if (!data) return configMap;
123
+ for (const entry of data.split("\0")) {
124
+ const newlineIndex = entry.indexOf("\n");
125
+ if (newlineIndex === -1) continue;
126
+ const key = entry.substring(0, newlineIndex);
127
+ const value = entry.substring(newlineIndex + 1);
128
+ const values = configMap.get(key);
129
+ if (values != null) values.push(value);
130
+ else configMap.set(key, [value]);
131
+ }
132
+ return configMap;
133
+ }
114
134
  function parseGitBoolean(value) {
115
135
  if (value == null) return false;
116
136
  const normalized = value.toLowerCase().trim();
@@ -167,6 +187,22 @@ var ConfigGitSubProvider = class {
167
187
  const global = options?.global || repoPath == null;
168
188
  return this.cache.getConfigRegex(global ? void 0 : repoPath, pattern, () => this.getConfigRegexCore(repoPath, pattern, options));
169
189
  }
190
+ /**
191
+ * Every value of each key matching `pattern` (`git config --get-regexp`), for a key git lets repeat, like
192
+ * `remote.<name>.fetch`: {@link getConfigRegex} keeps only each key's last value. Cached beside it, so the same
193
+ * writes and config changes clear it. Rejects when git couldn't read the configuration.
194
+ */
195
+ async getConfigRegexAll(repoPath, pattern) {
196
+ const joined = await this.cache.getConfigRegex(repoPath, `\0all\0${pattern}`, async () => {
197
+ const result = await this.git.run({
198
+ cwd: this.cache.getCommonPath(repoPath),
199
+ errors: "ignore"
200
+ }, "config", "--null", "--get-regexp", pattern);
201
+ if (result.completion.status !== "exited" || result.exitCode !== 0 && result.exitCode !== 1) throw new Error(`Unable to read the config keys matching '${pattern}'`);
202
+ return new Map(Array.from(parseConfigRegexNullOutput(result.stdout), ([key, values]) => [key, values.join("\0")]));
203
+ });
204
+ return new Map(Array.from(joined, ([key, value]) => [key, value.split("\0")]));
205
+ }
170
206
  async getConfigRegexCore(repoPath, pattern, options) {
171
207
  const args = ["config", "--get-regex"];
172
208
  if (options?.file) args.push("-f", options.file);
@@ -733,6 +769,7 @@ var ConfigGitSubProvider = class {
733
769
  };
734
770
  __decorate([trace()], ConfigGitSubProvider.prototype, "getConfig", null);
735
771
  __decorate([trace()], ConfigGitSubProvider.prototype, "getConfigRegex", null);
772
+ __decorate([trace()], ConfigGitSubProvider.prototype, "getConfigRegexAll", null);
736
773
  __decorate([debug()], ConfigGitSubProvider.prototype, "setConfig", null);
737
774
  __decorate([gate(), debug()], ConfigGitSubProvider.prototype, "getCurrentUser", null);
738
775
  __decorate([gate(), trace({ exit: (r) => `returned ${r}` })], ConfigGitSubProvider.prototype, "getDefaultWorktreePath", null);
@@ -747,6 +784,6 @@ __decorate([debug()], ConfigGitSubProvider.prototype, "validateSigningSetup", nu
747
784
  __decorate([debug()], ConfigGitSubProvider.prototype, "setSigningConfig", null);
748
785
  __decorate([gate(), debug()], ConfigGitSubProvider.prototype, "migrateGkConfigFromGitConfig", null);
749
786
  //#endregion
750
- export { ConfigGitSubProvider, canonicalizeGitConfigKey, gkConfigFingerprintClock, isGitBooleanFalse, isGkConfigStatRacy, parseConfigRegexOutput, parseGitBoolean };
787
+ export { ConfigGitSubProvider, canonicalizeGitConfigKey, gkConfigFingerprintClock, isGitBooleanFalse, isGkConfigStatRacy, parseConfigRegexNullOutput, parseConfigRegexOutput, parseGitBoolean };
751
788
 
752
789
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["process_env","fs"],"sources":["../../../../git-cli/src/providers/config.ts"],"sourcesContent":["import { promises as fs, statSync } from 'fs';\nimport { hostname, userInfo } from 'os';\nimport { env as process_env } from 'process';\nimport type { Cache, GkConfigInvalidationTarget, GkReconcileOutcome } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport { WorkspaceUntrustedError } from '@gitlens/git/errors.js';\nimport type { GitDir } from '@gitlens/git/models/repository.js';\nimport type { SigningConfig, SigningFormat, ValidationResult } from '@gitlens/git/models/signature.js';\nimport type { GitUser } from '@gitlens/git/models/user.js';\nimport type {\n\tDeprecatedGkConfigKeys,\n\tGitConfigKeys,\n\tGitConfigSubProvider,\n\tGitConfigType,\n\tGkConfigKeys,\n} from '@gitlens/git/providers/config.js';\nimport { parseBranchMetadataGkConfigKey } from '@gitlens/git/utils/branch.utils.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug, trace } from '@gitlens/utils/decorators/log.js';\nimport { first, some } from '@gitlens/utils/iterable.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { dirname, getBestPath, isAbsolute, joinPaths, normalizePath } from '@gitlens/utils/path.js';\nimport { fileUri } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderInternal } from '../cliGitProvider.js';\nimport { fsExists } from '../exec/exec.js';\nimport type { Git } from '../exec/git.js';\nimport { KeyedSequencer } from '../exec/indexLock.js';\n\nconst mappedAuthorRegex = /(.+)\\s<(.+)>/;\nconst emptyArray: readonly never[] = Object.freeze([]);\n\n/** Catch-all pattern matching every key in `.git/gk/config` for the one-shot bulk read. */\nconst gkConfigAllPattern = '.';\n\n/**\n * Maps from failed bulk reads, which a reconcile must not diff as the file's content, each to the read that produced\n * it. Module-wide, like {@link gkConfigMapReads}: a reconcile can join a read another provider sharing its `Cache`\n * started.\n */\nconst failedGkConfigMaps = new WeakMap<Map<string, string>, GkConfigMapRead>();\n\n/** What the bulk read behind a cached gk config map saw of `.git/gk/config` before it spawned */\ninterface GkConfigMapRead {\n\t/** Set as the read spawns; until then it can only see the file as it is after every change reported so far */\n\tspawned: boolean;\n\tpath?: string;\n\t/** The file's {@link getGkConfigFingerprint} taken right before the read spawned; `undefined` when untrusted */\n\tfingerprint?: string;\n}\n\n/**\n * The read behind each commonPath's cached gk config map, per `Cache`. Recorded as the read starts, which is when\n * the cache creates the entry for it, so it always describes the entry cached now. Kept per `Cache` rather than per\n * provider, since providers sharing a `Cache` serve each other's reads.\n */\nconst gkConfigMapReads = new WeakMap<Cache, Map<string, GkConfigMapRead>>();\n\n/** The wall clock a read's fingerprint is checked against (see {@link isGkConfigStatRacy}), exported for testing */\nexport const gkConfigFingerprintClock = { now: (): number => Date.now() };\n\nconst nsPerMs = 1_000_000n;\nconst nsPerSecond = 1_000_000_000n;\n\n/**\n * Whether a stat of `.git/gk/config` taken at `statTimeMs` came too soon after the file's last change to vouch for\n * the file staying unchanged while it matches — git's \"racily clean\" index entries. A later write in the same tick of\n * the filesystem's clock as that change, of the same size and given the inode the stat saw (freed by the write in\n * between and reused), gets the same fingerprint; once the stat is a tick past the change, any later write carries a\n * later time. Times that are whole seconds come from a filesystem that keeps no finer (ext4 with 128-byte inodes,\n * HFS+, FAT's 2-second mtime, some network mounts), so the stat must be 2s past; otherwise 50ms covers the coarsest\n * tick a finer clock still has (a 10ms jiffy, Windows' 15.6ms timer) and the wall clock lagging it by one. A file\n * changed after `statTimeMs` (a clock ahead of ours) is racy too. Exported for testing.\n */\nexport function isGkConfigStatRacy(mtimeNs: bigint, ctimeNs: bigint, statTimeMs: number): boolean {\n\tconst changedNs = mtimeNs > ctimeNs ? mtimeNs : ctimeNs;\n\tconst marginNs = mtimeNs % nsPerSecond === 0n && ctimeNs % nsPerSecond === 0n ? 2n * nsPerSecond : 50n * nsPerMs;\n\treturn BigInt(Math.floor(statTimeMs)) * nsPerMs - changedNs < marginNs;\n}\n\n/**\n * A stat of `.git/gk/config` that two stats share only if no write landed between them: `git config` writes a lock\n * file and renames it over the original, so every write gives the file a new inode, and its size and times tell\n * apart a later write that lands on a freed inode — unless that write fell in the same clock tick as the change the\n * first stat saw, which `statTimeMs` rules out (see {@link isGkConfigStatRacy}): given the time the stat is taken,\n * a stat that racy is `undefined`, never matching. `'absent'` when there is no file, `undefined` when it can't be\n * stat'd.\n */\nfunction getGkConfigFingerprint(path: string, statTimeMs?: number): string | undefined {\n\ttry {\n\t\tconst stat = statSync(path, { bigint: true, throwIfNoEntry: false });\n\t\tif (stat == null) return 'absent';\n\t\tif (statTimeMs != null && isGkConfigStatRacy(stat.mtimeNs, stat.ctimeNs, statTimeMs)) return undefined;\n\n\t\treturn `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Canonicalizes a git config key for lookup against `--get-regexp` output, which git emits with the\n * section and variable-name lowercased and only the subsection case-preserved. Without this a\n * subsection-less key like `gk.defaultRemote` would miss the lowercased `gk.defaultremote` in the map.\n */\nexport function canonicalizeGitConfigKey(key: string): string {\n\tconst first = key.indexOf('.');\n\tif (first === -1) return key.toLowerCase();\n\n\tconst last = key.lastIndexOf('.');\n\t// `section.name` (no subsection) → fully lowercased; `section.subsection.name` → lowercase\n\t// section + name, preserve the case-sensitive subsection in the middle.\n\tif (first === last) return key.toLowerCase();\n\treturn `${key.slice(0, first).toLowerCase()}${key.slice(first, last)}${key.slice(last).toLowerCase()}`;\n}\n\n/**\n * Parses git config --get-regex output into a Map.\n * The output format is \"key value\" per line, where key and value are space-separated.\n *\n * A line with NO space at all is git's rendering of a bareword/valueless entry (`key`, no `=`) — git's\n * OWN config parser reads that as boolean TRUE (git-config(1): \"a variable defined without `= <value>`\n * is taken as true\"), confirmed against git's `format_config` (builtin/config.c): the key-delimiter is\n * appended unconditionally, then backed out ONLY when the stored value is NULL (the bareword case) —\n * an explicit empty value (`key =`) is a real, non-NULL empty string, so its line KEEPS the trailing\n * space and is already handled by the branch below, byte-distinct from a bareword line.\n *\n * By default a bareword line is skipped (the historical behavior, which reads as \"unset\" — wrong, but\n * safe); pass `includeValueless` to map it to the literal string `'true'` instead, so `parseGitBoolean`\n * and callers checking `.has()` for \"configured\" both read it correctly.\n */\nexport function parseConfigRegexOutput(\n\tdata: string | undefined,\n\toptions?: { includeValueless?: boolean },\n): Map<string, string> {\n\tconst configMap = new Map<string, string>();\n\tif (!data) return configMap;\n\n\tfor (const line of data.split('\\n')) {\n\t\tif (!line) continue;\n\n\t\tconst spaceIndex = line.indexOf(' ');\n\t\tif (spaceIndex === -1) {\n\t\t\tif (options?.includeValueless) {\n\t\t\t\tconfigMap.set(line, 'true');\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tconfigMap.set(line.substring(0, spaceIndex), line.substring(spaceIndex + 1));\n\t}\n\n\treturn configMap;\n}\n\nexport function parseGitBoolean(value: string | undefined): boolean {\n\tif (value == null) return false;\n\n\tconst normalized = value.toLowerCase().trim();\n\treturn normalized === 'true' || normalized === 'yes' || normalized === 'on' || normalized === '1';\n}\n\n/** Whether a git config value spells boolean-false (`false`/`no`/`off`/`0`/empty), per git's maybe-bool parsing. */\nexport function isGitBooleanFalse(value: string): boolean {\n\tconst normalized = value.toLowerCase().trim();\n\treturn (\n\t\tnormalized === '' || normalized === 'false' || normalized === 'no' || normalized === 'off' || normalized === '0'\n\t);\n}\n\nexport class ConfigGitSubProvider implements GitConfigSubProvider {\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\t\tthis.cache.setGkConfigReconciler((repoPath, priorSnapshot) => this.reconcileGkConfig(repoPath, priorSnapshot));\n\t}\n\n\t/**\n\t * In-flight gk-config reconciles keyed by commonPath. `pending` records that another `'gkConfig'`\n\t * event landed mid-pass, so one trailing pass runs after the current one settles. `paths` holds every\n\t * worktree path that reported the change, mapped to its close generation at that moment — the pass\n\t * reads through one that's still open and notifies all of them.\n\t */\n\tprivate readonly _gkConfigReconciles = new Map<string, { pending: boolean; paths: Map<string, number> }>();\n\n\t/**\n\t * The latest pending `setGkConfig` write of each `commonPath\\0key`. A call writing the same value with the same\n\t * skip option joins it; any other call chains after it, so one key's writes land in call order. Cleared on settle.\n\t */\n\tprivate readonly _pendingGkConfigWrites = new Map<\n\t\tstring,\n\t\t{ value: string | undefined; skipKey: string; promise: Promise<void> }\n\t>();\n\n\t/** Writes each `.git/gk/config` one at a time — concurrent `git config` writes fail on its lock */\n\tprivate readonly _gkConfigWrites = new KeyedSequencer();\n\n\t@trace()\n\tgetConfig(\n\t\trepoPath: string | undefined,\n\t\tkey: GitConfigKeys,\n\t\toptions?: { global?: boolean; runGitLocally?: boolean; type?: GitConfigType },\n\t): Promise<string | undefined> {\n\t\tconst global = options?.global || repoPath == null;\n\t\treturn this.cache.getConfig(global ? undefined : repoPath, key, () =>\n\t\t\tthis.getConfigCore(repoPath, key, options),\n\t\t);\n\t}\n\n\tprivate async getConfigCore(\n\t\trepoPath: string | undefined,\n\t\tkey: string,\n\t\toptions?: { file?: string; global?: boolean; runGitLocally?: boolean; type?: GitConfigType },\n\t): Promise<string | undefined> {\n\t\tconst args = ['config', '--get'];\n\t\tif (options?.file) {\n\t\t\targs.push('-f', options.file);\n\t\t} else if (options?.global || repoPath == null) {\n\t\t\targs.push('--global');\n\t\t}\n\t\tif (options?.type) {\n\t\t\targs.push(`--type=${options.type}`);\n\t\t}\n\t\targs.push(key);\n\n\t\tconst result = await this.git.run(\n\t\t\t{ cwd: repoPath ?? '', errors: 'ignore', runLocally: options?.runGitLocally },\n\t\t\t...args,\n\t\t);\n\t\treturn result.stdout.trim() || undefined;\n\t}\n\n\t@trace()\n\tgetConfigRegex(\n\t\trepoPath: string | undefined,\n\t\tpattern: string,\n\t\toptions?: { global?: boolean; runGitLocally?: boolean },\n\t): Promise<Map<string, string>> {\n\t\tconst global = options?.global || repoPath == null;\n\t\treturn this.cache.getConfigRegex(global ? undefined : repoPath, pattern, () =>\n\t\t\tthis.getConfigRegexCore(repoPath, pattern, options),\n\t\t);\n\t}\n\n\tprivate async getConfigRegexCore(\n\t\trepoPath: string | undefined,\n\t\tpattern: string,\n\t\toptions?: { file?: string; global?: boolean; runGitLocally?: boolean },\n\t): Promise<Map<string, string>> {\n\t\tconst args = ['config', '--get-regex'];\n\t\tif (options?.file) {\n\t\t\targs.push('-f', options.file);\n\t\t} else if (options?.global || repoPath == null) {\n\t\t\targs.push('--global');\n\t\t}\n\t\targs.push(pattern);\n\n\t\tconst result = await this.git.run(\n\t\t\t{ cwd: repoPath ?? '', errors: 'ignore', runLocally: options?.runGitLocally },\n\t\t\t...args,\n\t\t);\n\t\t// Deliberately NOT `.trim()`-ed: an explicit-empty value's LAST line ends in a meaningful trailing\n\t\t// space, and `.trim()`-ing the whole (possibly multi-line) buffer strips it — `parseConfigRegexOutput`\n\t\t// already skips the blank line a trailing newline produces, so no trim is needed.\n\t\treturn parseConfigRegexOutput(result.stdout);\n\t}\n\n\t@debug()\n\tasync setConfig(\n\t\trepoPath: string | undefined,\n\t\tkey: GitConfigKeys,\n\t\tvalue: string | undefined,\n\t\toptions?: { file?: string; global?: boolean },\n\t): Promise<void> {\n\t\tawait this.setConfigCore(repoPath, key, value, options);\n\n\t\t// A branch's upstream (`remote`/`merge`) is read back through the cached branch list, which a\n\t\t// `'config'` reset alone leaves serving the old tracking info.\n\t\tif (repoPath != null && !options?.file && /^branch\\..+\\.(?:remote|merge)$/i.test(key)) {\n\t\t\tthis.context.hooks?.cache?.onReset?.(repoPath, 'branches');\n\t\t}\n\n\t\t// A `--global` or custom-`file` write isn't this repository's `.git/config`\n\t\tif (repoPath != null && !options?.file && !options?.global) {\n\t\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['config']);\n\t\t}\n\t}\n\n\tprivate async setConfigCore(\n\t\trepoPath: string | undefined,\n\t\tkey: string,\n\t\tvalue: string | undefined,\n\t\toptions?: { file?: string; global?: boolean },\n\t): Promise<void> {\n\t\tconst args: string[] = ['config'];\n\n\t\tif (options?.file) {\n\t\t\targs.push('-f', options.file);\n\t\t} else {\n\t\t\tconst global = options?.global || repoPath == null;\n\t\t\targs.push(global ? '--global' : '--local');\n\t\t}\n\n\t\tif (value == null) {\n\t\t\targs.push('--unset', key);\n\t\t} else {\n\t\t\targs.push(key, value);\n\t\t}\n\n\t\tawait this.git.run({ cwd: repoPath ?? '', runLocally: true }, ...args);\n\n\t\t// Only invalidate cache when not using a custom file (custom files aren't cached)\n\t\tif (!options?.file) {\n\t\t\tconst global = options?.global || repoPath == null;\n\t\t\t// Invalidate the cached value for this key and clear all regex patterns for this scope\n\t\t\tthis.cache.deleteConfig(global ? undefined : repoPath, key);\n\t\t}\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getCurrentUser(repoPath: string): Promise<GitUser | undefined> {\n\t\tif (!repoPath) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst cached = this.cache.currentUser.get(repoPath);\n\t\tif (cached != null) return cached;\n\t\t// If we found null, user data was not found - don't bother trying again\n\t\tif (cached === null) return undefined;\n\n\t\tconst user: GitUser = { name: undefined, email: undefined };\n\n\t\ttry {\n\t\t\tconst configMap = await this.getConfigRegex(repoPath, '^user\\\\.(name|email)$', {\n\t\t\t\trunGitLocally: true,\n\t\t\t});\n\t\t\tif (configMap.size) {\n\t\t\t\tuser.name = configMap.get('user.name');\n\t\t\t\tuser.email = configMap.get('user.email');\n\t\t\t} else {\n\t\t\t\tuser.name =\n\t\t\t\t\tprocess_env.GIT_AUTHOR_NAME || process_env.GIT_COMMITTER_NAME || userInfo()?.username || undefined;\n\t\t\t\tif (!user.name) {\n\t\t\t\t\t// If we found no user data, mark it so we won't bother trying again\n\t\t\t\t\tthis.cache.currentUser.set(repoPath, null);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tuser.email =\n\t\t\t\t\tprocess_env.GIT_AUTHOR_EMAIL ||\n\t\t\t\t\tprocess_env.GIT_COMMITTER_EMAIL ||\n\t\t\t\t\tprocess_env.EMAIL ||\n\t\t\t\t\t`${user.name}@${hostname()}`;\n\t\t\t}\n\n\t\t\tconst author = `${user.name} <${user.email}>`;\n\t\t\t// Check if there is a mailmap for the current user\n\t\t\tconst result = await this.git.run({ cwd: repoPath, errors: 'ignore' }, 'check-mailmap', author);\n\n\t\t\tif (result.stdout && result.stdout !== author) {\n\t\t\t\tconst match = mappedAuthorRegex.exec(result.stdout);\n\t\t\t\tif (match != null) {\n\t\t\t\t\t[, user.name, user.email] = match;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.cache.currentUser.set(repoPath, user);\n\t\t\treturn user;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\n\t\t\t// Mark it so we won't bother trying again\n\t\t\tthis.cache.currentUser.set(repoPath, null);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@gate()\n\t@trace({ exit: r => `returned ${r}` })\n\tasync getDefaultWorktreePath(repoPath: string): Promise<string | undefined> {\n\t\tconst gitDir = await this.getGitDir(repoPath);\n\t\tif (gitDir == null) return undefined;\n\n\t\tconst basePath = (gitDir.commonUri ?? gitDir.uri).fsPath;\n\t\treturn getBestPath(normalizePath(joinPaths(basePath, '..')));\n\t}\n\n\t@gate()\n\t@trace({\n\t\texit: r =>\n\t\t\t`returned ${r.uri.toString(true)}, commonUri=${r.commonUri?.toString(true)}, parentUri=${r.parentUri?.toString(true)}`,\n\t})\n\tasync getGitDir(repoPath: string): Promise<GitDir> {\n\t\tconst cached = this.cache.gitDir.get(repoPath);\n\t\tif (cached != null) return cached;\n\n\t\tconst scope = getScopedLogger();\n\t\tconst repoInfo = await this.getRepositoryInfo(repoPath);\n\n\t\tlet gitDir: GitDir;\n\t\tif (!Array.isArray(repoInfo) && repoInfo != null) {\n\t\t\tgitDir = {\n\t\t\t\turi: fileUri(repoInfo.gitDir),\n\t\t\t\tcommonUri: repoInfo.commonGitDir ? fileUri(repoInfo.commonGitDir) : undefined,\n\t\t\t\tparentUri: repoInfo.superprojectPath ? fileUri(repoInfo.superprojectPath) : undefined,\n\t\t\t};\n\t\t} else {\n\t\t\tgitDir = {\n\t\t\t\turi: this.provider.getAbsoluteUri(joinPaths(repoPath, '.git'), repoPath),\n\t\t\t};\n\n\t\t\tconst gitDirPath = gitDir.uri.toString(true);\n\t\t\tscope?.warn(`rev-parse failed for '${repoPath}'; falling back to '${gitDirPath}'`);\n\t\t\tthis.context.hooks?.operations?.onGitDirResolveFailed?.(\n\t\t\t\trepoPath,\n\t\t\t\tgitDirPath,\n\t\t\t\t`rev_parse returned ${JSON.stringify(repoInfo)}`,\n\t\t\t);\n\t\t}\n\t\tthis.cache.gitDir.set(repoPath, gitDir);\n\n\t\treturn gitDir;\n\t}\n\n\t/**\n\t * Gets the path to the .git/gk/config file for storing GitKraken-specific metadata.\n\t * Uses commonPath for worktrees so all worktrees share the same data.\n\t */\n\tprivate async getGkConfigPath(repoPath: string): Promise<string | undefined> {\n\t\tconst gitDir = await this.getGitDir(repoPath);\n\t\tif (gitDir == null) return undefined;\n\n\t\t// Use commonUri (main .git dir) for worktrees, otherwise use uri\n\t\tconst basePath = (gitDir.commonUri ?? gitDir.uri).fsPath;\n\t\treturn joinPaths(basePath, 'gk', 'config');\n\t}\n\n\t@trace()\n\tasync getGkConfig(repoPath: string, key: GkConfigKeys | DeprecatedGkConfigKeys): Promise<string | undefined> {\n\t\t// Served in-memory from a single bulk read of the whole `.git/gk/config` (no gk read needs `--type`).\n\t\t// Canonicalize the key the way git does for `--get-regexp` output so subsection-less keys\n\t\t// (e.g. `gk.defaultRemote`) match, and coerce an empty value to undefined to match the old\n\t\t// `git config --get` (`.trim() || undefined`) contract.\n\t\treturn (await this.getGkConfigMap(repoPath)).get(canonicalizeGitConfigKey(key)) || undefined;\n\t}\n\n\t@trace()\n\tasync getGkConfigRegex(repoPath: string, pattern: string): Promise<Map<string, string>> {\n\t\tconst all = await this.getGkConfigMap(repoPath);\n\n\t\t// Filter the bulk map in-memory. The old path passed `pattern` to `git config --get-regex`\n\t\t// (errors ignored → empty result on a bad pattern); preserve that no-throw contract here\n\t\t// rather than letting an invalid-JS pattern reject the read.\n\t\tlet re: RegExp;\n\t\ttry {\n\t\t\tre = new RegExp(pattern);\n\t\t} catch {\n\t\t\treturn new Map();\n\t\t}\n\n\t\tconst result = new Map<string, string>();\n\t\tfor (const [k, v] of all) {\n\t\t\tif (re.test(k)) {\n\t\t\t\tresult.set(k, v);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Reads the entire `.git/gk/config` in one `git config --get-regexp` and caches the parsed map\n\t * per commonPath. Per-key (getGkConfig) and per-namespace (getGkConfigRegex) lookups are served\n\t * from this single cached read — so a branch-overview render that fans out across several gk\n\t * namespaces costs one `git config` call instead of one per namespace.\n\t */\n\tprivate async getGkConfigMap(repoPath: string): Promise<Map<string, string>> {\n\t\t// Migrate BEFORE populating the cache, not inside the factory: a first-time migration calls\n\t\t// clearCaches('gkConfig'), which would otherwise evict the in-flight gkConfigMap entry the\n\t\t// cache wrapper synchronously stored and force a redundant bulk re-read. Checked here too, not only in the\n\t\t// migration: every gk lookup lands here, and entering the migration logs it.\n\t\tconst commonPath = this.cache.getCommonPath(repoPath);\n\t\tif (!this._migratedRepos.has(commonPath)) {\n\t\t\tawait this.migrateGkConfigFromGitConfig(commonPath);\n\t\t}\n\t\treturn this.cache.getGkConfigMap(repoPath, async cacheable => {\n\t\t\tconst read = this.trackGkConfigMapRead(repoPath);\n\t\t\tconst { map, failed } = await this.getGkConfigRegexCore(repoPath, gkConfigAllPattern, read);\n\t\t\t// This map has no TTL and everything gk-related reads through it, so a failed read cached as an\n\t\t\t// empty map would report every branch as having no stored base or merge target for the session —\n\t\t\t// and would make the section-cleanup pre-checks skip real work. Only cache a read that happened.\n\t\t\tif (failed) {\n\t\t\t\tcacheable.invalidate();\n\t\t\t\tfailedGkConfigMaps.set(map, read);\n\t\t\t}\n\t\t\treturn map;\n\t\t});\n\t}\n\n\t/** Records the read that is creating `repoPath`'s cached gk config map (see {@link gkConfigMapReads}) */\n\tprivate trackGkConfigMapRead(repoPath: string): GkConfigMapRead {\n\t\tlet reads = gkConfigMapReads.get(this.cache);\n\t\tif (reads == null) {\n\t\t\treads = new Map();\n\t\t\tgkConfigMapReads.set(this.cache, reads);\n\t\t}\n\n\t\tconst read: GkConfigMapRead = { spawned: false };\n\t\treads.set(this.cache.getCommonPath(repoPath), read);\n\t\treturn read;\n\t}\n\n\t/**\n\t * Hard-evicts the cached gk config map, unless `.git/gk/config` is unchanged since the read behind it stat'd the\n\t * file, or that read is yet to spawn. The stat is taken before the read, so a write landing between the two\n\t * only costs a re-read on its report, never a missed change. Returns the read it kept, if any.\n\t */\n\tprivate evictGkConfigMapIfChanged(repoPath: string): GkConfigMapRead | undefined {\n\t\tconst read = gkConfigMapReads.get(this.cache)?.get(this.cache.getCommonPath(repoPath));\n\t\tif (read != null) {\n\t\t\tif (!read.spawned) return read;\n\t\t\tif (\n\t\t\t\tread.path != null &&\n\t\t\t\tread.fingerprint != null &&\n\t\t\t\tgetGkConfigFingerprint(read.path) === read.fingerprint\n\t\t\t) {\n\t\t\t\treturn read;\n\t\t\t}\n\t\t}\n\n\t\tthis.cache.deleteGkConfigMap(repoPath);\n\t\treturn undefined;\n\t}\n\n\tprivate async getGkConfigRegexCore(\n\t\trepoPath: string,\n\t\tpattern: string,\n\t\tread: GkConfigMapRead,\n\t): Promise<{ map: Map<string, string>; failed: boolean }> {\n\t\tconst gkConfigPath = await this.getGkConfigPath(repoPath);\n\t\tif (!gkConfigPath) {\n\t\t\tread.spawned = true;\n\t\t\t// No `.git/gk/config` yet is a real answer, not a failure — a repo GitLens has never written to.\n\t\t\treturn { map: new Map(), failed: false };\n\t\t}\n\n\t\t// Taken before the spawn, never after: a write landing in between then only makes its report re-read the file.\n\t\t// The clock is read before the stat, so the stat is no earlier than the time it's checked against.\n\t\tread.path = gkConfigPath;\n\t\tread.fingerprint = getGkConfigFingerprint(gkConfigPath, gkConfigFingerprintClock.now());\n\t\tread.spawned = true;\n\t\tconst result = await this.git.run(\n\t\t\t{ cwd: repoPath, errors: 'ignore', runLocally: true },\n\t\t\t'config',\n\t\t\t'--get-regex',\n\t\t\t'-f',\n\t\t\tgkConfigPath,\n\t\t\tpattern,\n\t\t);\n\t\t// `--get-regex` exits 1 when nothing matches, which IS an answer (an empty gk config).\n\t\tconst exited = result.completion.status === 'exited';\n\t\treturn {\n\t\t\t// Deliberately NOT `.trim()`-ed — see `getConfigRegexCore`'s comment: it strips the trailing\n\t\t\t// space that marks an explicit-empty value's LAST line, silently dropping it from the map.\n\t\t\tmap: parseConfigRegexOutput(result.stdout),\n\t\t\tfailed: !exited || (result.exitCode !== 0 && result.exitCode !== 1),\n\t\t};\n\t}\n\n\t@debug()\n\tasync setGkConfig(\n\t\trepoPath: string,\n\t\tkey: GkConfigKeys | DeprecatedGkConfigKeys,\n\t\tvalue: string | undefined,\n\t\toptions?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },\n\t): Promise<void> {\n\t\t// A self-write (with skip targets) and a user-driven write of the same value have different invalidation\n\t\t// semantics, so only a matching skip option may join: otherwise the user-driven write would skip invalidation.\n\t\t// Sorted, so the same targets in any order match.\n\t\tconst commonPath = this.cache.getCommonPath(repoPath);\n\t\tconst skipKey = options?.skipInvalidation?.length ? options.skipInvalidation.toSorted().join(',') : '';\n\t\tconst pendingKey = `${commonPath}\\0${key}`;\n\n\t\tconst previous = this._pendingGkConfigWrites.get(pendingKey);\n\t\tif (previous != null && previous.value === value && previous.skipKey === skipKey) return previous.promise;\n\n\t\tconst promise =\n\t\t\tprevious != null\n\t\t\t\t? previous.promise.catch(() => {}).then(() => this.setGkConfigCore(repoPath, key, value, options))\n\t\t\t\t: this.setGkConfigCore(repoPath, key, value, options);\n\t\tconst pending = { value: value, skipKey: skipKey, promise: promise };\n\t\tthis._pendingGkConfigWrites.set(pendingKey, pending);\n\t\t// Swallow the cleanup chain's rejection so a failed write doesn't surface as an unhandled\n\t\t// rejection separate from the caller's own handling of the returned promise.\n\t\tvoid promise\n\t\t\t.finally(() => {\n\t\t\t\tif (this._pendingGkConfigWrites.get(pendingKey) === pending) {\n\t\t\t\t\tthis._pendingGkConfigWrites.delete(pendingKey);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(() => {});\n\t\treturn promise;\n\t}\n\n\tprivate async setGkConfigCore(\n\t\trepoPath: string,\n\t\tkey: GkConfigKeys | DeprecatedGkConfigKeys,\n\t\tvalue: string | undefined,\n\t\toptions?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },\n\t): Promise<void> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst gkConfigPath = await this.getGkConfigPath(repoPath);\n\t\tif (!gkConfigPath) return;\n\n\t\tconst gkConfigFolder = joinPaths(gkConfigPath, '..');\n\n\t\tif (!(await this.ensureGkConfigFolder(gkConfigFolder, scope))) return;\n\n\t\t// Seed the reconcile snapshot from the pre-write file, so the write below can tell whether it changed the\n\t\t// value (first tracked-key write per repository only; the bulk read is cached for everything else)\n\t\tif (this.cache.needsGkConfigSnapshot(repoPath, key)) {\n\t\t\tawait this.getGkConfigMap(repoPath);\n\t\t}\n\n\t\tawait this._gkConfigWrites.run(gkConfigPath, undefined, () =>\n\t\t\tthis.setConfigCore(repoPath, key, value, { file: gkConfigPath }),\n\t\t);\n\n\t\t// Invalidate the bulk map (so the next read re-fetches) and the derived caches for this key's\n\t\t// ref, then record the write, which fires `onDidChangeMergeTargets` when it changed a merge key —\n\t\t// except for a self-write (`skipInvalidation` given: an internal save while answering a read), which\n\t\t// nobody awaits; only another process's watcher reports that one.\n\t\t// The `.git/gk/config` file-watcher also fires `'gkConfig'` shortly after, which reconciles\n\t\t// the same change (see `reconcileGkConfig`) — recording our own write here keeps that later\n\t\t// reconcile from re-diffing this key as an external change.\n\t\tthis.cache.deleteGkConfig(repoPath, key, options);\n\t\tthis.cache.recordGkConfigWrite(repoPath, key, value, { announce: options?.skipInvalidation == null });\n\n\t\t// The watcher's report of this write can't reach the cached branches: the snapshot already holds the value\n\t\tconst metadataKey = parseBranchMetadataGkConfigKey(key);\n\t\tif (metadataKey != null) {\n\t\t\tthis.cache.patchBranchMetadata(repoPath, [\n\t\t\t\t{ branch: metadataKey.branch, key: metadataKey.key, value: value },\n\t\t\t]);\n\t\t}\n\t}\n\n\t@debug()\n\tasync removeGkConfigBranchSection(repoPath: string, ref: string): Promise<void> {\n\t\tif (await this.runGkConfigSectionCommand(repoPath, ref, '--remove-section', `branch.${ref}`)) {\n\t\t\tthis.cache.recordGkConfigSectionWrite(repoPath, ref);\n\t\t}\n\t}\n\n\t@debug()\n\tasync renameGkConfigBranchSection(repoPath: string, oldRef: string, newRef: string): Promise<void> {\n\t\t// Clear the destination first, unconditionally. `--rename-section` onto a section that already\n\t\t// exists APPENDS rather than replaces, leaving duplicate keys — and git resolves a duplicated key\n\t\t// to its LAST value, so the orphan left by an earlier branch of this name would win over the\n\t\t// metadata being moved. Doing this outside `runGkConfigSectionCommand` also covers the case where\n\t\t// the source has no gk keys at all, where its pre-check would otherwise skip the whole call and\n\t\t// leave the orphan in place for the renamed branch to inherit.\n\t\tawait this.removeGkConfigBranchSection(repoPath, newRef);\n\t\tif (\n\t\t\tawait this.runGkConfigSectionCommand(\n\t\t\t\trepoPath,\n\t\t\t\toldRef,\n\t\t\t\t'--rename-section',\n\t\t\t\t`branch.${oldRef}`,\n\t\t\t\t`branch.${newRef}`,\n\t\t\t)\n\t\t) {\n\t\t\tthis.cache.recordGkConfigSectionWrite(repoPath, oldRef, newRef);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a section-level `git config` against `.git/gk/config` for `ref`'s section, skipping the\n\t * subprocess entirely when the bulk map (already cached on any warm path) shows that ref has no gk\n\t * keys — the overwhelmingly common case, since most branches never get gk metadata written at all.\n\t *\n\t * Never throws: callers invoke this as bookkeeping after a branch op has already succeeded, so a\n\t * failure here must not be reported as (or roll back) the branch/checkout/worktree operation itself.\n\t * The worst case is metadata that stays behind until the next op on that name.\n\t *\n\t * Returns whether `.git/gk/config` now reflects the command (it ran, or there was nothing to do), so the\n\t * caller can record its own write in the reconcile snapshot only when it actually landed.\n\t */\n\tprivate async runGkConfigSectionCommand(repoPath: string, ref: string, ...args: string[]): Promise<boolean> {\n\t\tconst scope = getScopedLogger();\n\t\ttry {\n\t\t\tconst prefix = `branch.${ref}.`;\n\t\t\tconst map = await this.getGkConfigMap(repoPath);\n\t\t\t// The shortcut needs a map with CONTENT to be trustworthy. A failed bulk read resolves empty\n\t\t\t// (see `getGkConfigMap`) — the cache refuses it, but this caller still holds it — and an empty map\n\t\t\t// read as authoritative would skip the removal entirely, leaving a deleted branch's base,\n\t\t\t// disposition and issue links behind for the next branch reusing that name. When it's empty, run\n\t\t\t// the command: worst case is a no-op on a section that isn't there.\n\t\t\tif (map.size && !some(map.keys(), k => k.startsWith(prefix))) return true;\n\n\t\t\tconst gkConfigPath = await this.getGkConfigPath(repoPath);\n\t\t\tif (!gkConfigPath) return false;\n\t\t\t// `getGkConfigPath` only joins a path, so check the file: with no `.git/gk/config` there is\n\t\t\t// genuinely nothing to remove, and running the command would fail with a fatal we'd then warn\n\t\t\t// about on every branch delete in a repo that has never had gk metadata.\n\t\t\tif (!(await fsExists(gkConfigPath))) return true;\n\n\t\t\tconst result = await this._gkConfigWrites.run(gkConfigPath, undefined, () =>\n\t\t\t\tthis.git.run(\n\t\t\t\t\t{ cwd: repoPath, runLocally: true, errors: 'ignore' },\n\t\t\t\t\t'config',\n\t\t\t\t\t'-f',\n\t\t\t\t\tgkConfigPath,\n\t\t\t\t\t...args,\n\t\t\t\t),\n\t\t\t);\n\t\t\t// `errors: 'ignore'` is deliberate — see the note above on why this must never throw — but that\n\t\t\t// also means the `catch` below never sees a failed write, so without this the metadata silently\n\t\t\t// stays behind (or, on a rename, stays under the old name) with nothing recorded anywhere.\n\t\t\t// Reported, not thrown: the branch op it follows has already succeeded.\n\t\t\tconst succeeded = result.completion.status === 'exited' && result.exitCode === 0;\n\t\t\tif (!succeeded) {\n\t\t\t\tscope?.warn(\n\t\t\t\t\t`Failed to update gk config section for '${ref}' in '${repoPath}': ${\n\t\t\t\t\t\tresult.completion.status === 'exited'\n\t\t\t\t\t\t\t? `git config exited ${result.exitCode}`\n\t\t\t\t\t\t\t: `${result.completion.status} · ${result.completion.error.message}`\n\t\t\t\t\t}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// A whole section moved or vanished, which the per-key `deleteGkConfig` cascade can't express.\n\t\t\t// Drop the bulk map so the next read hits disk; the derived caches for the affected ref are\n\t\t\t// evicted by the caller's own `deleteBaseBranchName` plus the `'branches'` cascade it fires.\n\t\t\tthis.cache.deleteGkConfigMap(repoPath);\n\t\t\treturn succeeded;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, `Failed to update gk config section for '${ref}' in '${repoPath}'`);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Reconciles a watcher-observed `'gkConfig'` change — registered with the shared `Cache` as its\n\t * gk-config reconciler (see the constructor). Hard-evicts the bulk map as the change is reported, unless the file\n\t * is unchanged since the map was read (see `evictGkConfigMapIfChanged`), then reads it (from disk, or the map\n\t * kept) and diffs it against `priorSnapshot` to cascade\n\t * `baseBranchName`/`branchOverviews` only for refs whose merge-relevant keys actually changed, and to evict the\n\t * branches only when a branch metadata key (another process's activity stamp) changed. The diff runs on a kept\n\t * map too: a read can land between an external write and its report, and already hold the change.\n\t *\n\t * Serialized per commonPath: a reconcile is a read-then-diff against a single shared baseline, so\n\t * two overlapping passes would both diff against the same snapshot and the later change could fall\n\t * out entirely. An event arriving mid-pass instead queues one trailing pass, which re-reads and\n\t * diffs against the baseline the previous pass just established.\n\t *\n\t * `.git/gk/config` lives in the common dir, so the watcher delivers one event per worktree sharing it\n\t * (see `WatchGroup.onCommonEvent`), and core's own write is reported too. Siblings never run concurrently — the\n\t * later ones fold into the in-flight pass — but folding in arms the trailing pass, which re-diffs the map unless\n\t * the file changed again. However many siblings land while a pass is running, they coalesce into that single\n\t * trailing pass; the cost is the price of never dropping a real change.\n\t * Every reporting path is retained because `Repository` matches the follow-up change event on exact\n\t * path, and a sibling worktree that never receives one would sit on stale derived values.\n\t */\n\tprivate reconcileGkConfig(\n\t\trepoPath: string,\n\t\tpriorSnapshot: ReadonlyMap<string, string> | undefined,\n\t): GkReconcileOutcome | Promise<GkReconcileOutcome> {\n\t\tconst commonPath = this.cache.getCommonPath(repoPath);\n\n\t\tconst inflight = this._gkConfigReconciles.get(commonPath);\n\t\tif (inflight != null) {\n\t\t\t// Now, not in the trailing pass: a read between this report and that pass must see the change, and would\n\t\t\t// otherwise join the map read before it\n\t\t\tthis.evictGkConfigMapIfChanged(repoPath);\n\t\t\tinflight.paths.set(repoPath, this.cache.getCloseGeneration(repoPath));\n\t\t\tinflight.pending = true;\n\t\t\t// Handed to the in-flight pass's trailing loop, so it IS being reconciled — just not by this\n\t\t\t// call. Reporting a failure here would coarse-clear on every write in a burst.\n\t\t\treturn 'deferred';\n\t\t}\n\n\t\tconst entry = { pending: false, paths: new Map([[repoPath, this.cache.getCloseGeneration(repoPath)]]) };\n\t\tthis._gkConfigReconciles.set(commonPath, entry);\n\t\treturn this.runGkConfigReconcile(commonPath, priorSnapshot, entry);\n\t}\n\n\t/** Drops paths that closed since they reported the change; returns whichever remain. */\n\tprivate pruneClosedReconcilePaths(paths: Map<string, number>): Map<string, number> {\n\t\tfor (const [path, generation] of paths) {\n\t\t\tif (this.cache.getCloseGeneration(path) !== generation) {\n\t\t\t\tpaths.delete(path);\n\t\t\t}\n\t\t}\n\t\treturn paths;\n\t}\n\n\tprivate async runGkConfigReconcile(\n\t\tcommonPath: string,\n\t\tpriorSnapshot: ReadonlyMap<string, string> | undefined,\n\t\tentry: { pending: boolean; paths: Map<string, number> },\n\t): Promise<GkReconcileOutcome> {\n\t\tconst scope = getScopedLogger();\n\t\tlet snapshot = priorSnapshot;\n\n\t\ttry {\n\t\t\tdo {\n\t\t\t\tentry.pending = false;\n\n\t\t\t\t// Read through a path that's still open — one worktree closing must not drop the event for\n\t\t\t\t// its still-open siblings, which is why this reads from the surviving set rather than from\n\t\t\t\t// whichever path happened to report first.\n\t\t\t\tconst readPath = first(this.pruneClosedReconcilePaths(entry.paths).keys());\n\t\t\t\t// Every path that reported the change has since closed — nothing left to reconcile, and\n\t\t\t\t// nothing left holding a stale derived value either.\n\t\t\t\tif (readPath == null) return 'reconciled';\n\n\t\t\t\t// Runs before this pass's first await, so a first pass decides as the change is reported; a trailing one\n\t\t\t\t// re-checks the map the pass before it read\n\t\t\t\tconst kept = this.evictGkConfigMapIfChanged(readPath);\n\t\t\t\tlet freshMap = await this.getGkConfigMap(readPath);\n\t\t\t\t// A kept read that failed was started before this pass, which would otherwise have read the file\n\t\t\t\t// itself, so it gets one fresh read before the coarse fallback\n\t\t\t\tif (kept != null && failedGkConfigMaps.get(freshMap) === kept) {\n\t\t\t\t\tthis.cache.deleteGkConfigMap(readPath);\n\t\t\t\t\tfreshMap = await this.getGkConfigMap(readPath);\n\t\t\t\t}\n\t\t\t\t// A failed read diffed as the file's content would remove every key it missed\n\t\t\t\tif (failedGkConfigMaps.has(freshMap)) {\n\t\t\t\t\tthrow new Error(`Failed to read the gk config through '${readPath}'`);\n\t\t\t\t}\n\n\t\t\t\t// Paths may have closed while the re-read was in flight; if every one did, there's nothing\n\t\t\t\t// left to reconcile against.\n\t\t\t\tif (!this.pruneClosedReconcilePaths(entry.paths).size) return 'reconciled';\n\n\t\t\t\tif (this.cache.reconcileGkConfigMap(readPath, snapshot, freshMap)) {\n\t\t\t\t\t// Fire a follow-up change: a consumer that re-read on the original event may have done so\n\t\t\t\t\t// before this async cascade landed, so it would otherwise hold a stale derived value with\n\t\t\t\t\t// nothing left to prompt another re-read. Only the host hears it: it is not a write of\n\t\t\t\t\t// core's, and announcing it as one would evict the map just reconciled.\n\t\t\t\t\tfor (const path of entry.paths.keys()) {\n\t\t\t\t\t\tthis.provider.notifyHost(path, ['gkConfig']);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// `reconcileGkConfigMap` advanced the stored baseline to what we just read; a trailing pass\n\t\t\t\t// diffs its own read against that.\n\t\t\t\tsnapshot = this.cache.getGkConfigSnapshot(readPath);\n\t\t\t} while (entry.pending);\n\n\t\t\treturn 'reconciled';\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, `Failed to reconcile gk config for '${commonPath}'`);\n\t\t\t// The caller falls back to the coarse clear — derived caches are otherwise left holding\n\t\t\t// pre-change values with nothing to correct them.\n\t\t\treturn 'failed';\n\t\t} finally {\n\t\t\tthis._gkConfigReconciles.delete(commonPath);\n\t\t}\n\t}\n\n\t@debug()\n\tasync getSigningConfig(repoPath: string): Promise<SigningConfig> {\n\t\t// Fetch all signing-related config in one call\n\t\tconst configMap = await this.getConfigRegex(\n\t\t\trepoPath,\n\t\t\t'^(commit\\\\.gpgsign|gpg\\\\.format|user\\\\.signingkey|gpg\\\\.program|gpg\\\\.ssh\\\\.program|gpg\\\\.ssh\\\\.allowedsignersfile)$',\n\t\t);\n\n\t\t// Extract values (keys are lowercase in git output)\n\t\tconst enabledRaw = configMap.get('commit.gpgsign');\n\t\tconst format = configMap.get('gpg.format');\n\t\tconst signingKey = configMap.get('user.signingkey');\n\t\tconst gpgProgram = configMap.get('gpg.program');\n\t\tconst sshProgram = configMap.get('gpg.ssh.program');\n\t\tconst allowedSignersFile = configMap.get('gpg.ssh.allowedsignersfile');\n\n\t\t// Check if git config has commit signing enabled, falling back to the host-level override\n\t\t// (e.g. VS Code's `git.enableCommitSigning`) when `commit.gpgsign` is unset/false. The host\n\t\t// override can only enable signing, never force it off.\n\t\tconst isEnabled = parseGitBoolean(enabledRaw) || this.context.config?.signing?.enabled === true;\n\n\t\treturn {\n\t\t\tenabled: isEnabled,\n\t\t\tformat: (format as SigningFormat) ?? 'gpg',\n\t\t\tsigningKey: signingKey,\n\t\t\tgpgProgram: gpgProgram,\n\t\t\tsshProgram: sshProgram,\n\t\t\tallowedSignersFile: allowedSignersFile,\n\t\t};\n\t}\n\n\t@debug()\n\tasync validateSigningSetup(repoPath: string): Promise<ValidationResult> {\n\t\tconst config = await this.getSigningConfig(repoPath);\n\n\t\tif (!config.signingKey) {\n\t\t\treturn { valid: false, error: 'No signing key configured' };\n\t\t}\n\n\t\t// Basic validation: just check that a signing key is configured\n\t\t// Git will handle the actual validation when signing commits\n\t\treturn { valid: true };\n\t}\n\n\t@debug()\n\tasync setSigningConfig(\n\t\trepoPath: string,\n\t\tconfig: Partial<SigningConfig>,\n\t\toptions?: { global?: boolean },\n\t): Promise<void> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst entries: [GitConfigKeys, string][] = [];\n\t\tif (config.enabled != null) {\n\t\t\tentries.push(['commit.gpgsign', config.enabled ? 'true' : 'false']);\n\t\t}\n\t\tif (config.format != null) {\n\t\t\tentries.push(['gpg.format', config.format]);\n\t\t}\n\t\tif (config.signingKey != null) {\n\t\t\tentries.push(['user.signingkey', config.signingKey]);\n\t\t}\n\t\tif (config.gpgProgram != null) {\n\t\t\tentries.push(['gpg.program', config.gpgProgram]);\n\t\t}\n\t\tif (config.sshProgram != null) {\n\t\t\tentries.push(['gpg.ssh.program', config.sshProgram]);\n\t\t}\n\t\tif (config.allowedSignersFile != null) {\n\t\t\tentries.push(['gpg.ssh.allowedSignersFile', config.allowedSignersFile]);\n\t\t}\n\n\t\tlet wrote = false;\n\t\ttry {\n\t\t\tfor (const [key, value] of entries) {\n\t\t\t\tawait this.setConfigCore(repoPath, key, value, options);\n\t\t\t\twrote = true;\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tthrow ex;\n\t\t} finally {\n\t\t\t// One `config` announcement for the keys written, rather than one (each fanned out to every worktree) per key\n\t\t\tif (wrote && !options?.global) {\n\t\t\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['config']);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetSigningConfigFlags(config: SigningConfig): string[] {\n\t\tconst flags: string[] = [];\n\n\t\tif (config.gpgProgram) {\n\t\t\tflags.push('-c', `gpg.program=${config.gpgProgram}`);\n\t\t}\n\t\tif (config.format && config.format !== 'gpg') {\n\t\t\tflags.push('-c', `gpg.format=${config.format}`);\n\t\t}\n\t\tif (config.sshProgram) {\n\t\t\tflags.push('-c', `gpg.ssh.program=${config.sshProgram}`);\n\t\t}\n\t\tif (config.allowedSignersFile) {\n\t\t\tflags.push('-c', `gpg.ssh.allowedSignersFile=${config.allowedSignersFile}`);\n\t\t}\n\n\t\treturn flags;\n\t}\n\n\tasync getRepositoryInfo(\n\t\tcwd: string,\n\t): Promise<\n\t\t| { repoPath: string; gitDir: string; commonGitDir: string | undefined; superprojectPath: string | undefined }\n\t\t| [safe: true, repoPath: string]\n\t\t| [safe: false]\n\t\t| []\n\t> {\n\t\tlet result;\n\n\t\tif (this.context.workspace?.isTrusted === false) {\n\t\t\ttry {\n\t\t\t\tawait fs.stat(joinPaths(cwd, 'HEAD'));\n\t\t\t\tresult = await this.git.run(\n\t\t\t\t\t{ cwd: cwd, errors: 'throw', configs: ['-C', cwd] },\n\t\t\t\t\t'rev-parse',\n\t\t\t\t\t'--show-cdup',\n\t\t\t\t);\n\t\t\t\tif (!result.stdout.trim()) {\n\t\t\t\t\tLogger.warn(`Skipping (untrusted); bare clone repository detected in '${cwd}'`);\n\t\t\t\t\treturn emptyArray as [];\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// If this throws, we should be good to open the repo\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tresult = await this.git.run(\n\t\t\t\t{ cwd: cwd, errors: 'throw' },\n\t\t\t\t'rev-parse',\n\t\t\t\t'--show-toplevel',\n\t\t\t\t'--git-dir',\n\t\t\t\t'--git-common-dir',\n\t\t\t\t'--show-superproject-working-tree',\n\t\t\t);\n\t\t\tif (!result.stdout) return emptyArray as [];\n\n\t\t\t// Output is 3-4 lines: show-toplevel, git-dir, git-common-dir, [show-superproject-working-tree]\n\t\t\t// The 4th line is only present for submodules\n\t\t\tconst lines = result.stdout.split('\\n').map(r => r.trimStart());\n\t\t\tconst [repoPath, dotGitPath, commonDotGitPath, superprojectPath] = lines;\n\n\t\t\tif (!repoPath) return emptyArray as [];\n\n\t\t\tconst normalizedRepoPath = normalizePath(repoPath.replace(/[\\r|\\n]+$/, ''));\n\n\t\t\tlet gitDir = dotGitPath;\n\t\t\tif (gitDir && !isAbsolute(gitDir)) {\n\t\t\t\tgitDir = joinPaths(cwd, gitDir);\n\t\t\t}\n\t\t\tgitDir = normalizePath(gitDir);\n\n\t\t\tlet commonGitDir: string | undefined;\n\t\t\tif (commonDotGitPath) {\n\t\t\t\tcommonGitDir = commonDotGitPath;\n\t\t\t\tif (!isAbsolute(commonGitDir)) {\n\t\t\t\t\tcommonGitDir = joinPaths(cwd, commonGitDir);\n\t\t\t\t}\n\t\t\t\tcommonGitDir = normalizePath(commonGitDir);\n\t\t\t\tif (commonGitDir === gitDir) {\n\t\t\t\t\tcommonGitDir = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trepoPath: normalizedRepoPath,\n\t\t\t\tgitDir: gitDir,\n\t\t\t\tcommonGitDir: commonGitDir,\n\t\t\t\tsuperprojectPath: superprojectPath?.trim() || undefined,\n\t\t\t};\n\t\t} catch (ex: any) {\n\t\t\tif (ex instanceof WorkspaceUntrustedError) return emptyArray as [];\n\n\t\t\tconst unsafeMatch =\n\t\t\t\t/(?:^fatal:\\s*detected dubious ownership in repository at '([^']+)'|unsafe repository \\('([^']+)' is owned by someone else\\))[\\s\\S]*(git config --global --add safe\\.directory [^\\n\\u2022]+)/m.exec(\n\t\t\t\t\tex.stderr,\n\t\t\t\t);\n\t\t\tif (unsafeMatch != null) {\n\t\t\t\tLogger.warn(\n\t\t\t\t\t`Skipping; unsafe repository detected in '${unsafeMatch[1] || unsafeMatch[2]}'; run '${\n\t\t\t\t\t\tunsafeMatch[3]\n\t\t\t\t\t}' to allow it`,\n\t\t\t\t);\n\t\t\t\treturn [false];\n\t\t\t}\n\n\t\t\tconst inDotGit = /this operation must be run in a work tree/.test(ex.stderr);\n\t\t\tif (inDotGit && this.context.workspace?.isTrusted !== false) {\n\t\t\t\tresult = await this.git.run({ cwd: cwd, errors: 'ignore' }, 'rev-parse', '--is-bare-repository');\n\t\t\t\tif (result.stdout.trim() === 'true') {\n\t\t\t\t\tconst result = await this.revParseGitDir(cwd);\n\t\t\t\t\tconst repoPath = result?.commonPath ?? result?.path;\n\t\t\t\t\tif (repoPath?.length) return [true, repoPath];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (inDotGit || ex.code === 'ENOENT') {\n\t\t\t\tlet exists = inDotGit ? false : await fsExists(cwd);\n\t\t\t\tif (!exists) {\n\t\t\t\t\tdo {\n\t\t\t\t\t\tconst parent = dirname(cwd);\n\t\t\t\t\t\tif (parent === cwd || parent.length === 0) return emptyArray as [];\n\n\t\t\t\t\t\tcwd = parent;\n\t\t\t\t\t\texists = await fsExists(cwd);\n\t\t\t\t\t} while (!exists);\n\n\t\t\t\t\treturn this.getRepositoryInfo(cwd);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn emptyArray as [];\n\t\t}\n\t}\n\n\tprivate async revParseGitDir(cwd: string): Promise<{ path: string; commonPath?: string } | undefined> {\n\t\tconst result = await this.git.run({ cwd: cwd, errors: 'ignore' }, 'rev-parse', '--git-dir', '--git-common-dir');\n\t\tif (!result.stdout) return undefined;\n\n\t\tlet [dotGitPath, commonDotGitPath] = result.stdout.split('\\n').map(r => r.trimStart());\n\n\t\tif (!isAbsolute(dotGitPath)) {\n\t\t\tdotGitPath = joinPaths(cwd, dotGitPath);\n\t\t}\n\t\tdotGitPath = normalizePath(dotGitPath);\n\n\t\tif (commonDotGitPath) {\n\t\t\tif (!isAbsolute(commonDotGitPath)) {\n\t\t\t\tcommonDotGitPath = joinPaths(cwd, commonDotGitPath);\n\t\t\t}\n\t\t\tcommonDotGitPath = normalizePath(commonDotGitPath);\n\n\t\t\treturn { path: dotGitPath, commonPath: commonDotGitPath !== dotGitPath ? commonDotGitPath : undefined };\n\t\t}\n\n\t\treturn { path: dotGitPath };\n\t}\n\n\t/**\n\t * Ensures the `.git/gk/` folder exists, but only if the parent `.git` directory already exists.\n\t * This prevents creating stray `.git` directories if the computed path is wrong.\n\t * Returns `true` if the folder was ensured, `false` if the parent `.git` does not exist.\n\t */\n\tprivate async ensureGkConfigFolder(\n\t\tgkConfigFolder: string,\n\t\tscope: ReturnType<typeof getScopedLogger>,\n\t): Promise<boolean> {\n\t\t// Verify the .git directory already exists — never create it from scratch\n\t\tconst dotGitDir = joinPaths(gkConfigFolder, '..');\n\t\ttry {\n\t\t\tawait fs.stat(dotGitDir);\n\t\t} catch {\n\t\t\tscope?.warn(`Skipping GK config write — expected git directory '${dotGitDir}' does not exist`);\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\tawait fs.mkdir(gkConfigFolder, { recursive: true });\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, `Failed to create '${gkConfigFolder}' directory`);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate _migratedRepos = new Set<string>();\n\n\t/**\n\t * One-time migration of GK config entries from regular git config to `.git/gk/config`.\n\t * If `.git/gk/config` already exists, assumes migration is complete (or data is already there).\n\t * Preserves existing `.git/gk/config` values as source of truth (won't overwrite).\n\t * Removes migrated keys from regular git config to stop cluttering it.\n\t */\n\t@gate()\n\t@debug()\n\tprivate async migrateGkConfigFromGitConfig(repoPath: string): Promise<void> {\n\t\tif (this._migratedRepos.has(repoPath)) return;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst gkConfigPath = await this.getGkConfigPath(repoPath);\n\t\tif (!gkConfigPath) {\n\t\t\tthis._migratedRepos.add(repoPath);\n\t\t\treturn;\n\t\t}\n\n\t\tconst gkConfigFolder = joinPaths(gkConfigPath, '..');\n\n\t\t// If .git/gk/config already exists, consider migration done — it was either\n\t\t// already migrated or values were written there directly via setGkConfig\n\t\ttry {\n\t\t\tawait fs.stat(gkConfigPath);\n\t\t\tthis._migratedRepos.add(repoPath);\n\t\t\treturn;\n\t\t} catch {\n\t\t\t// file doesn't exist, proceed with migration\n\t\t}\n\n\t\t// If .git/gk/config doesn't exist, create an empty file to prevent multiple migration attempts in future sessions\n\t\tif (!(await this.ensureGkConfigFolder(gkConfigFolder, scope))) return;\n\n\t\ttry {\n\t\t\tawait fs.writeFile(gkConfigPath, new Uint8Array());\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, `Failed to create '${gkConfigPath}' file`);\n\t\t}\n\n\t\t// Read legacy gk-* keys from regular git config\n\t\tlet migrateConfig: Map<string, string>;\n\t\ttry {\n\t\t\tmigrateConfig = await this.getConfigRegexCore(repoPath, '^branch\\\\..*\\\\.gk-', { runGitLocally: true });\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, 'Failed to read legacy GK config entries');\n\t\t\tthis._migratedRepos.add(repoPath);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!migrateConfig.size) {\n\t\t\tthis._migratedRepos.add(repoPath);\n\t\t\treturn;\n\t\t}\n\n\t\tscope?.info(`Migrating ${String(migrateConfig.size)} GK config entries from git config to .git/gk/config`);\n\n\t\t// Copy legacy entries to .git/gk/config\n\t\tfor (const [key, value] of [...migrateConfig]) {\n\t\t\ttry {\n\t\t\t\tawait this._gkConfigWrites.run(gkConfigPath, undefined, () =>\n\t\t\t\t\tthis.setConfigCore(repoPath, key, value, { file: gkConfigPath }),\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex, `Failed to migrate key '${key}' to GK config`);\n\t\t\t\t// If we failed to migrate, delete it from the list so we won't try to remove it from git config later\n\t\t\t\tmigrateConfig.delete(key);\n\t\t\t}\n\t\t}\n\n\t\t// Remove legacy keys from regular git config (use --unset-all defensively)\n\t\tfor (const [key] of migrateConfig) {\n\t\t\ttry {\n\t\t\t\tawait this.git.run(\n\t\t\t\t\t{ cwd: repoPath, errors: 'ignore', runLocally: true },\n\t\t\t\t\t'config',\n\t\t\t\t\t'--local',\n\t\t\t\t\t'--unset-all',\n\t\t\t\t\tkey,\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex, `Failed to remove migrated key '${key}' from git config`);\n\t\t\t}\n\t\t}\n\n\t\t// Clear caches since we modified both config files\n\t\tthis.cache.clearCaches(repoPath, 'config', 'gkConfig');\n\n\t\tthis._migratedRepos.add(repoPath);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6BA,MAAM,oBAAoB;AAC1B,MAAM,aAA+B,OAAO,OAAO,CAAC,CAAC;;AAGrD,MAAM,qBAAqB;;;;;;AAO3B,MAAM,qCAAqB,IAAI,QAA8C;;;;;;AAgB7E,MAAM,mCAAmB,IAAI,QAA6C;;AAG1E,MAAa,2BAA2B,EAAE,WAAmB,KAAK,IAAI,EAAE;AAExE,MAAM,UAAU;AAChB,MAAM,cAAc;;;;;;;;;;;AAYpB,SAAgB,mBAAmB,SAAiB,SAAiB,YAA6B;CACjG,MAAM,YAAY,UAAU,UAAU,UAAU;CAChD,MAAM,WAAW,UAAU,gBAAgB,MAAM,UAAU,gBAAgB,KAAK,KAAK,cAAc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AA8ON,WAAA,CAAA,KAAK,GACL,MAAM,CAAA,GAAA,qBAAA,WAAA,gCAAA,IAAA"}
1
+ {"version":3,"file":"config.js","names":["process_env","fs"],"sources":["../../../../git-cli/src/providers/config.ts"],"sourcesContent":["import { promises as fs, statSync } from 'fs';\nimport { hostname, userInfo } from 'os';\nimport { env as process_env } from 'process';\nimport type { Cache, GkConfigInvalidationTarget, GkReconcileOutcome } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport { WorkspaceUntrustedError } from '@gitlens/git/errors.js';\nimport type { GitDir } from '@gitlens/git/models/repository.js';\nimport type { SigningConfig, SigningFormat, ValidationResult } from '@gitlens/git/models/signature.js';\nimport type { GitUser } from '@gitlens/git/models/user.js';\nimport type {\n\tDeprecatedGkConfigKeys,\n\tGitConfigKeys,\n\tGitConfigSubProvider,\n\tGitConfigType,\n\tGkConfigKeys,\n} from '@gitlens/git/providers/config.js';\nimport { parseBranchMetadataGkConfigKey } from '@gitlens/git/utils/branch.utils.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug, trace } from '@gitlens/utils/decorators/log.js';\nimport { first, some } from '@gitlens/utils/iterable.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { dirname, getBestPath, isAbsolute, joinPaths, normalizePath } from '@gitlens/utils/path.js';\nimport { fileUri } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderInternal } from '../cliGitProvider.js';\nimport { fsExists } from '../exec/exec.js';\nimport type { Git } from '../exec/git.js';\nimport { KeyedSequencer } from '../exec/indexLock.js';\n\nconst mappedAuthorRegex = /(.+)\\s<(.+)>/;\nconst emptyArray: readonly never[] = Object.freeze([]);\n\n/** Catch-all pattern matching every key in `.git/gk/config` for the one-shot bulk read. */\nconst gkConfigAllPattern = '.';\n\n/**\n * Maps from failed bulk reads, which a reconcile must not diff as the file's content, each to the read that produced\n * it. Module-wide, like {@link gkConfigMapReads}: a reconcile can join a read another provider sharing its `Cache`\n * started.\n */\nconst failedGkConfigMaps = new WeakMap<Map<string, string>, GkConfigMapRead>();\n\n/** What the bulk read behind a cached gk config map saw of `.git/gk/config` before it spawned */\ninterface GkConfigMapRead {\n\t/** Set as the read spawns; until then it can only see the file as it is after every change reported so far */\n\tspawned: boolean;\n\tpath?: string;\n\t/** The file's {@link getGkConfigFingerprint} taken right before the read spawned; `undefined` when untrusted */\n\tfingerprint?: string;\n}\n\n/**\n * The read behind each commonPath's cached gk config map, per `Cache`. Recorded as the read starts, which is when\n * the cache creates the entry for it, so it always describes the entry cached now. Kept per `Cache` rather than per\n * provider, since providers sharing a `Cache` serve each other's reads.\n */\nconst gkConfigMapReads = new WeakMap<Cache, Map<string, GkConfigMapRead>>();\n\n/** The wall clock a read's fingerprint is checked against (see {@link isGkConfigStatRacy}), exported for testing */\nexport const gkConfigFingerprintClock = { now: (): number => Date.now() };\n\nconst nsPerMs = 1_000_000n;\nconst nsPerSecond = 1_000_000_000n;\n\n/**\n * Whether a stat of `.git/gk/config` taken at `statTimeMs` came too soon after the file's last change to vouch for\n * the file staying unchanged while it matches — git's \"racily clean\" index entries. A later write in the same tick of\n * the filesystem's clock as that change, of the same size and given the inode the stat saw (freed by the write in\n * between and reused), gets the same fingerprint; once the stat is a tick past the change, any later write carries a\n * later time. Times that are whole seconds come from a filesystem that keeps no finer (ext4 with 128-byte inodes,\n * HFS+, FAT's 2-second mtime, some network mounts), so the stat must be 2s past; otherwise 50ms covers the coarsest\n * tick a finer clock still has (a 10ms jiffy, Windows' 15.6ms timer) and the wall clock lagging it by one. A file\n * changed after `statTimeMs` (a clock ahead of ours) is racy too. Exported for testing.\n */\nexport function isGkConfigStatRacy(mtimeNs: bigint, ctimeNs: bigint, statTimeMs: number): boolean {\n\tconst changedNs = mtimeNs > ctimeNs ? mtimeNs : ctimeNs;\n\tconst marginNs = mtimeNs % nsPerSecond === 0n && ctimeNs % nsPerSecond === 0n ? 2n * nsPerSecond : 50n * nsPerMs;\n\treturn BigInt(Math.floor(statTimeMs)) * nsPerMs - changedNs < marginNs;\n}\n\n/**\n * A stat of `.git/gk/config` that two stats share only if no write landed between them: `git config` writes a lock\n * file and renames it over the original, so every write gives the file a new inode, and its size and times tell\n * apart a later write that lands on a freed inode — unless that write fell in the same clock tick as the change the\n * first stat saw, which `statTimeMs` rules out (see {@link isGkConfigStatRacy}): given the time the stat is taken,\n * a stat that racy is `undefined`, never matching. `'absent'` when there is no file, `undefined` when it can't be\n * stat'd.\n */\nfunction getGkConfigFingerprint(path: string, statTimeMs?: number): string | undefined {\n\ttry {\n\t\tconst stat = statSync(path, { bigint: true, throwIfNoEntry: false });\n\t\tif (stat == null) return 'absent';\n\t\tif (statTimeMs != null && isGkConfigStatRacy(stat.mtimeNs, stat.ctimeNs, statTimeMs)) return undefined;\n\n\t\treturn `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Canonicalizes a git config key for lookup against `--get-regexp` output, which git emits with the\n * section and variable-name lowercased and only the subsection case-preserved. Without this a\n * subsection-less key like `gk.defaultRemote` would miss the lowercased `gk.defaultremote` in the map.\n */\nexport function canonicalizeGitConfigKey(key: string): string {\n\tconst first = key.indexOf('.');\n\tif (first === -1) return key.toLowerCase();\n\n\tconst last = key.lastIndexOf('.');\n\t// `section.name` (no subsection) → fully lowercased; `section.subsection.name` → lowercase\n\t// section + name, preserve the case-sensitive subsection in the middle.\n\tif (first === last) return key.toLowerCase();\n\treturn `${key.slice(0, first).toLowerCase()}${key.slice(first, last)}${key.slice(last).toLowerCase()}`;\n}\n\n/**\n * Parses git config --get-regex output into a Map.\n * The output format is \"key value\" per line, where key and value are space-separated.\n *\n * A line with NO space at all is git's rendering of a bareword/valueless entry (`key`, no `=`) — git's\n * OWN config parser reads that as boolean TRUE (git-config(1): \"a variable defined without `= <value>`\n * is taken as true\"), confirmed against git's `format_config` (builtin/config.c): the key-delimiter is\n * appended unconditionally, then backed out ONLY when the stored value is NULL (the bareword case) —\n * an explicit empty value (`key =`) is a real, non-NULL empty string, so its line KEEPS the trailing\n * space and is already handled by the branch below, byte-distinct from a bareword line.\n *\n * By default a bareword line is skipped (the historical behavior, which reads as \"unset\" — wrong, but\n * safe); pass `includeValueless` to map it to the literal string `'true'` instead, so `parseGitBoolean`\n * and callers checking `.has()` for \"configured\" both read it correctly.\n */\nexport function parseConfigRegexOutput(\n\tdata: string | undefined,\n\toptions?: { includeValueless?: boolean },\n): Map<string, string> {\n\tconst configMap = new Map<string, string>();\n\tif (!data) return configMap;\n\n\tfor (const line of data.split('\\n')) {\n\t\tif (!line) continue;\n\n\t\tconst spaceIndex = line.indexOf(' ');\n\t\tif (spaceIndex === -1) {\n\t\t\tif (options?.includeValueless) {\n\t\t\t\tconfigMap.set(line, 'true');\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tconfigMap.set(line.substring(0, spaceIndex), line.substring(spaceIndex + 1));\n\t}\n\n\treturn configMap;\n}\n\n/**\n * Parses `git config --null --get-regexp` output into every value of each key, in the order git printed them. Each\n * entry is its key, a newline and its value, ended by a NUL, so a value may hold newlines or spaces unambiguously.\n * A valueless entry (`key`, no `=`), which git prints with no newline, is skipped, as {@link parseConfigRegexOutput}\n * skips it by default.\n */\nexport function parseConfigRegexNullOutput(data: string | undefined): Map<string, string[]> {\n\tconst configMap = new Map<string, string[]>();\n\tif (!data) return configMap;\n\n\tfor (const entry of data.split('\\0')) {\n\t\tconst newlineIndex = entry.indexOf('\\n');\n\t\tif (newlineIndex === -1) continue;\n\n\t\tconst key = entry.substring(0, newlineIndex);\n\t\tconst value = entry.substring(newlineIndex + 1);\n\t\tconst values = configMap.get(key);\n\t\tif (values != null) {\n\t\t\tvalues.push(value);\n\t\t} else {\n\t\t\tconfigMap.set(key, [value]);\n\t\t}\n\t}\n\n\treturn configMap;\n}\n\nexport function parseGitBoolean(value: string | undefined): boolean {\n\tif (value == null) return false;\n\n\tconst normalized = value.toLowerCase().trim();\n\treturn normalized === 'true' || normalized === 'yes' || normalized === 'on' || normalized === '1';\n}\n\n/** Whether a git config value spells boolean-false (`false`/`no`/`off`/`0`/empty), per git's maybe-bool parsing. */\nexport function isGitBooleanFalse(value: string): boolean {\n\tconst normalized = value.toLowerCase().trim();\n\treturn (\n\t\tnormalized === '' || normalized === 'false' || normalized === 'no' || normalized === 'off' || normalized === '0'\n\t);\n}\n\nexport class ConfigGitSubProvider implements GitConfigSubProvider {\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\t\tthis.cache.setGkConfigReconciler((repoPath, priorSnapshot) => this.reconcileGkConfig(repoPath, priorSnapshot));\n\t}\n\n\t/**\n\t * In-flight gk-config reconciles keyed by commonPath. `pending` records that another `'gkConfig'`\n\t * event landed mid-pass, so one trailing pass runs after the current one settles. `paths` holds every\n\t * worktree path that reported the change, mapped to its close generation at that moment — the pass\n\t * reads through one that's still open and notifies all of them.\n\t */\n\tprivate readonly _gkConfigReconciles = new Map<string, { pending: boolean; paths: Map<string, number> }>();\n\n\t/**\n\t * The latest pending `setGkConfig` write of each `commonPath\\0key`. A call writing the same value with the same\n\t * skip option joins it; any other call chains after it, so one key's writes land in call order. Cleared on settle.\n\t */\n\tprivate readonly _pendingGkConfigWrites = new Map<\n\t\tstring,\n\t\t{ value: string | undefined; skipKey: string; promise: Promise<void> }\n\t>();\n\n\t/** Writes each `.git/gk/config` one at a time — concurrent `git config` writes fail on its lock */\n\tprivate readonly _gkConfigWrites = new KeyedSequencer();\n\n\t@trace()\n\tgetConfig(\n\t\trepoPath: string | undefined,\n\t\tkey: GitConfigKeys,\n\t\toptions?: { global?: boolean; runGitLocally?: boolean; type?: GitConfigType },\n\t): Promise<string | undefined> {\n\t\tconst global = options?.global || repoPath == null;\n\t\treturn this.cache.getConfig(global ? undefined : repoPath, key, () =>\n\t\t\tthis.getConfigCore(repoPath, key, options),\n\t\t);\n\t}\n\n\tprivate async getConfigCore(\n\t\trepoPath: string | undefined,\n\t\tkey: string,\n\t\toptions?: { file?: string; global?: boolean; runGitLocally?: boolean; type?: GitConfigType },\n\t): Promise<string | undefined> {\n\t\tconst args = ['config', '--get'];\n\t\tif (options?.file) {\n\t\t\targs.push('-f', options.file);\n\t\t} else if (options?.global || repoPath == null) {\n\t\t\targs.push('--global');\n\t\t}\n\t\tif (options?.type) {\n\t\t\targs.push(`--type=${options.type}`);\n\t\t}\n\t\targs.push(key);\n\n\t\tconst result = await this.git.run(\n\t\t\t{ cwd: repoPath ?? '', errors: 'ignore', runLocally: options?.runGitLocally },\n\t\t\t...args,\n\t\t);\n\t\treturn result.stdout.trim() || undefined;\n\t}\n\n\t@trace()\n\tgetConfigRegex(\n\t\trepoPath: string | undefined,\n\t\tpattern: string,\n\t\toptions?: { global?: boolean; runGitLocally?: boolean },\n\t): Promise<Map<string, string>> {\n\t\tconst global = options?.global || repoPath == null;\n\t\treturn this.cache.getConfigRegex(global ? undefined : repoPath, pattern, () =>\n\t\t\tthis.getConfigRegexCore(repoPath, pattern, options),\n\t\t);\n\t}\n\n\t/**\n\t * Every value of each key matching `pattern` (`git config --get-regexp`), for a key git lets repeat, like\n\t * `remote.<name>.fetch`: {@link getConfigRegex} keeps only each key's last value. Cached beside it, so the same\n\t * writes and config changes clear it. Rejects when git couldn't read the configuration.\n\t */\n\t@trace()\n\tasync getConfigRegexAll(repoPath: string, pattern: string): Promise<Map<string, string[]>> {\n\t\t// Under a key no regex is spelled as, with each key's values joined by a NUL, which no value can hold\n\t\tconst joined = await this.cache.getConfigRegex(repoPath, `\\0all\\0${pattern}`, async () => {\n\t\t\t// Read from the common path, never the caller's checkout: every worktree is served this one entry, so it\n\t\t\t// must not take in a `config.worktree` of whichever checkout happened to read first\n\t\t\tconst result = await this.git.run(\n\t\t\t\t{ cwd: this.cache.getCommonPath(repoPath), errors: 'ignore' },\n\t\t\t\t'config',\n\t\t\t\t'--null',\n\t\t\t\t'--get-regexp',\n\t\t\t\tpattern,\n\t\t\t);\n\t\t\t// 1 is git's exit code for no key matching\n\t\t\tif (result.completion.status !== 'exited' || (result.exitCode !== 0 && result.exitCode !== 1)) {\n\t\t\t\tthrow new Error(`Unable to read the config keys matching '${pattern}'`);\n\t\t\t}\n\n\t\t\treturn new Map(\n\t\t\t\tArray.from(parseConfigRegexNullOutput(result.stdout), ([key, values]) => [key, values.join('\\0')]),\n\t\t\t);\n\t\t});\n\t\treturn new Map(Array.from(joined, ([key, value]) => [key, value.split('\\0')]));\n\t}\n\n\tprivate async getConfigRegexCore(\n\t\trepoPath: string | undefined,\n\t\tpattern: string,\n\t\toptions?: { file?: string; global?: boolean; runGitLocally?: boolean },\n\t): Promise<Map<string, string>> {\n\t\tconst args = ['config', '--get-regex'];\n\t\tif (options?.file) {\n\t\t\targs.push('-f', options.file);\n\t\t} else if (options?.global || repoPath == null) {\n\t\t\targs.push('--global');\n\t\t}\n\t\targs.push(pattern);\n\n\t\tconst result = await this.git.run(\n\t\t\t{ cwd: repoPath ?? '', errors: 'ignore', runLocally: options?.runGitLocally },\n\t\t\t...args,\n\t\t);\n\t\t// Deliberately NOT `.trim()`-ed: an explicit-empty value's LAST line ends in a meaningful trailing\n\t\t// space, and `.trim()`-ing the whole (possibly multi-line) buffer strips it — `parseConfigRegexOutput`\n\t\t// already skips the blank line a trailing newline produces, so no trim is needed.\n\t\treturn parseConfigRegexOutput(result.stdout);\n\t}\n\n\t@debug()\n\tasync setConfig(\n\t\trepoPath: string | undefined,\n\t\tkey: GitConfigKeys,\n\t\tvalue: string | undefined,\n\t\toptions?: { file?: string; global?: boolean },\n\t): Promise<void> {\n\t\tawait this.setConfigCore(repoPath, key, value, options);\n\n\t\t// A branch's upstream (`remote`/`merge`) is read back through the cached branch list, which a\n\t\t// `'config'` reset alone leaves serving the old tracking info.\n\t\tif (repoPath != null && !options?.file && /^branch\\..+\\.(?:remote|merge)$/i.test(key)) {\n\t\t\tthis.context.hooks?.cache?.onReset?.(repoPath, 'branches');\n\t\t}\n\n\t\t// A `--global` or custom-`file` write isn't this repository's `.git/config`\n\t\tif (repoPath != null && !options?.file && !options?.global) {\n\t\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['config']);\n\t\t}\n\t}\n\n\tprivate async setConfigCore(\n\t\trepoPath: string | undefined,\n\t\tkey: string,\n\t\tvalue: string | undefined,\n\t\toptions?: { file?: string; global?: boolean },\n\t): Promise<void> {\n\t\tconst args: string[] = ['config'];\n\n\t\tif (options?.file) {\n\t\t\targs.push('-f', options.file);\n\t\t} else {\n\t\t\tconst global = options?.global || repoPath == null;\n\t\t\targs.push(global ? '--global' : '--local');\n\t\t}\n\n\t\tif (value == null) {\n\t\t\targs.push('--unset', key);\n\t\t} else {\n\t\t\targs.push(key, value);\n\t\t}\n\n\t\tawait this.git.run({ cwd: repoPath ?? '', runLocally: true }, ...args);\n\n\t\t// Only invalidate cache when not using a custom file (custom files aren't cached)\n\t\tif (!options?.file) {\n\t\t\tconst global = options?.global || repoPath == null;\n\t\t\t// Invalidate the cached value for this key and clear all regex patterns for this scope\n\t\t\tthis.cache.deleteConfig(global ? undefined : repoPath, key);\n\t\t}\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getCurrentUser(repoPath: string): Promise<GitUser | undefined> {\n\t\tif (!repoPath) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst cached = this.cache.currentUser.get(repoPath);\n\t\tif (cached != null) return cached;\n\t\t// If we found null, user data was not found - don't bother trying again\n\t\tif (cached === null) return undefined;\n\n\t\tconst user: GitUser = { name: undefined, email: undefined };\n\n\t\ttry {\n\t\t\tconst configMap = await this.getConfigRegex(repoPath, '^user\\\\.(name|email)$', {\n\t\t\t\trunGitLocally: true,\n\t\t\t});\n\t\t\tif (configMap.size) {\n\t\t\t\tuser.name = configMap.get('user.name');\n\t\t\t\tuser.email = configMap.get('user.email');\n\t\t\t} else {\n\t\t\t\tuser.name =\n\t\t\t\t\tprocess_env.GIT_AUTHOR_NAME || process_env.GIT_COMMITTER_NAME || userInfo()?.username || undefined;\n\t\t\t\tif (!user.name) {\n\t\t\t\t\t// If we found no user data, mark it so we won't bother trying again\n\t\t\t\t\tthis.cache.currentUser.set(repoPath, null);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tuser.email =\n\t\t\t\t\tprocess_env.GIT_AUTHOR_EMAIL ||\n\t\t\t\t\tprocess_env.GIT_COMMITTER_EMAIL ||\n\t\t\t\t\tprocess_env.EMAIL ||\n\t\t\t\t\t`${user.name}@${hostname()}`;\n\t\t\t}\n\n\t\t\tconst author = `${user.name} <${user.email}>`;\n\t\t\t// Check if there is a mailmap for the current user\n\t\t\tconst result = await this.git.run({ cwd: repoPath, errors: 'ignore' }, 'check-mailmap', author);\n\n\t\t\tif (result.stdout && result.stdout !== author) {\n\t\t\t\tconst match = mappedAuthorRegex.exec(result.stdout);\n\t\t\t\tif (match != null) {\n\t\t\t\t\t[, user.name, user.email] = match;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.cache.currentUser.set(repoPath, user);\n\t\t\treturn user;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\n\t\t\t// Mark it so we won't bother trying again\n\t\t\tthis.cache.currentUser.set(repoPath, null);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@gate()\n\t@trace({ exit: r => `returned ${r}` })\n\tasync getDefaultWorktreePath(repoPath: string): Promise<string | undefined> {\n\t\tconst gitDir = await this.getGitDir(repoPath);\n\t\tif (gitDir == null) return undefined;\n\n\t\tconst basePath = (gitDir.commonUri ?? gitDir.uri).fsPath;\n\t\treturn getBestPath(normalizePath(joinPaths(basePath, '..')));\n\t}\n\n\t@gate()\n\t@trace({\n\t\texit: r =>\n\t\t\t`returned ${r.uri.toString(true)}, commonUri=${r.commonUri?.toString(true)}, parentUri=${r.parentUri?.toString(true)}`,\n\t})\n\tasync getGitDir(repoPath: string): Promise<GitDir> {\n\t\tconst cached = this.cache.gitDir.get(repoPath);\n\t\tif (cached != null) return cached;\n\n\t\tconst scope = getScopedLogger();\n\t\tconst repoInfo = await this.getRepositoryInfo(repoPath);\n\n\t\tlet gitDir: GitDir;\n\t\tif (!Array.isArray(repoInfo) && repoInfo != null) {\n\t\t\tgitDir = {\n\t\t\t\turi: fileUri(repoInfo.gitDir),\n\t\t\t\tcommonUri: repoInfo.commonGitDir ? fileUri(repoInfo.commonGitDir) : undefined,\n\t\t\t\tparentUri: repoInfo.superprojectPath ? fileUri(repoInfo.superprojectPath) : undefined,\n\t\t\t};\n\t\t} else {\n\t\t\tgitDir = {\n\t\t\t\turi: this.provider.getAbsoluteUri(joinPaths(repoPath, '.git'), repoPath),\n\t\t\t};\n\n\t\t\tconst gitDirPath = gitDir.uri.toString(true);\n\t\t\tscope?.warn(`rev-parse failed for '${repoPath}'; falling back to '${gitDirPath}'`);\n\t\t\tthis.context.hooks?.operations?.onGitDirResolveFailed?.(\n\t\t\t\trepoPath,\n\t\t\t\tgitDirPath,\n\t\t\t\t`rev_parse returned ${JSON.stringify(repoInfo)}`,\n\t\t\t);\n\t\t}\n\t\tthis.cache.gitDir.set(repoPath, gitDir);\n\n\t\treturn gitDir;\n\t}\n\n\t/**\n\t * Gets the path to the .git/gk/config file for storing GitKraken-specific metadata.\n\t * Uses commonPath for worktrees so all worktrees share the same data.\n\t */\n\tprivate async getGkConfigPath(repoPath: string): Promise<string | undefined> {\n\t\tconst gitDir = await this.getGitDir(repoPath);\n\t\tif (gitDir == null) return undefined;\n\n\t\t// Use commonUri (main .git dir) for worktrees, otherwise use uri\n\t\tconst basePath = (gitDir.commonUri ?? gitDir.uri).fsPath;\n\t\treturn joinPaths(basePath, 'gk', 'config');\n\t}\n\n\t@trace()\n\tasync getGkConfig(repoPath: string, key: GkConfigKeys | DeprecatedGkConfigKeys): Promise<string | undefined> {\n\t\t// Served in-memory from a single bulk read of the whole `.git/gk/config` (no gk read needs `--type`).\n\t\t// Canonicalize the key the way git does for `--get-regexp` output so subsection-less keys\n\t\t// (e.g. `gk.defaultRemote`) match, and coerce an empty value to undefined to match the old\n\t\t// `git config --get` (`.trim() || undefined`) contract.\n\t\treturn (await this.getGkConfigMap(repoPath)).get(canonicalizeGitConfigKey(key)) || undefined;\n\t}\n\n\t@trace()\n\tasync getGkConfigRegex(repoPath: string, pattern: string): Promise<Map<string, string>> {\n\t\tconst all = await this.getGkConfigMap(repoPath);\n\n\t\t// Filter the bulk map in-memory. The old path passed `pattern` to `git config --get-regex`\n\t\t// (errors ignored → empty result on a bad pattern); preserve that no-throw contract here\n\t\t// rather than letting an invalid-JS pattern reject the read.\n\t\tlet re: RegExp;\n\t\ttry {\n\t\t\tre = new RegExp(pattern);\n\t\t} catch {\n\t\t\treturn new Map();\n\t\t}\n\n\t\tconst result = new Map<string, string>();\n\t\tfor (const [k, v] of all) {\n\t\t\tif (re.test(k)) {\n\t\t\t\tresult.set(k, v);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Reads the entire `.git/gk/config` in one `git config --get-regexp` and caches the parsed map\n\t * per commonPath. Per-key (getGkConfig) and per-namespace (getGkConfigRegex) lookups are served\n\t * from this single cached read — so a branch-overview render that fans out across several gk\n\t * namespaces costs one `git config` call instead of one per namespace.\n\t */\n\tprivate async getGkConfigMap(repoPath: string): Promise<Map<string, string>> {\n\t\t// Migrate BEFORE populating the cache, not inside the factory: a first-time migration calls\n\t\t// clearCaches('gkConfig'), which would otherwise evict the in-flight gkConfigMap entry the\n\t\t// cache wrapper synchronously stored and force a redundant bulk re-read. Checked here too, not only in the\n\t\t// migration: every gk lookup lands here, and entering the migration logs it.\n\t\tconst commonPath = this.cache.getCommonPath(repoPath);\n\t\tif (!this._migratedRepos.has(commonPath)) {\n\t\t\tawait this.migrateGkConfigFromGitConfig(commonPath);\n\t\t}\n\t\treturn this.cache.getGkConfigMap(repoPath, async cacheable => {\n\t\t\tconst read = this.trackGkConfigMapRead(repoPath);\n\t\t\tconst { map, failed } = await this.getGkConfigRegexCore(repoPath, gkConfigAllPattern, read);\n\t\t\t// This map has no TTL and everything gk-related reads through it, so a failed read cached as an\n\t\t\t// empty map would report every branch as having no stored base or merge target for the session —\n\t\t\t// and would make the section-cleanup pre-checks skip real work. Only cache a read that happened.\n\t\t\tif (failed) {\n\t\t\t\tcacheable.invalidate();\n\t\t\t\tfailedGkConfigMaps.set(map, read);\n\t\t\t}\n\t\t\treturn map;\n\t\t});\n\t}\n\n\t/** Records the read that is creating `repoPath`'s cached gk config map (see {@link gkConfigMapReads}) */\n\tprivate trackGkConfigMapRead(repoPath: string): GkConfigMapRead {\n\t\tlet reads = gkConfigMapReads.get(this.cache);\n\t\tif (reads == null) {\n\t\t\treads = new Map();\n\t\t\tgkConfigMapReads.set(this.cache, reads);\n\t\t}\n\n\t\tconst read: GkConfigMapRead = { spawned: false };\n\t\treads.set(this.cache.getCommonPath(repoPath), read);\n\t\treturn read;\n\t}\n\n\t/**\n\t * Hard-evicts the cached gk config map, unless `.git/gk/config` is unchanged since the read behind it stat'd the\n\t * file, or that read is yet to spawn. The stat is taken before the read, so a write landing between the two\n\t * only costs a re-read on its report, never a missed change. Returns the read it kept, if any.\n\t */\n\tprivate evictGkConfigMapIfChanged(repoPath: string): GkConfigMapRead | undefined {\n\t\tconst read = gkConfigMapReads.get(this.cache)?.get(this.cache.getCommonPath(repoPath));\n\t\tif (read != null) {\n\t\t\tif (!read.spawned) return read;\n\t\t\tif (\n\t\t\t\tread.path != null &&\n\t\t\t\tread.fingerprint != null &&\n\t\t\t\tgetGkConfigFingerprint(read.path) === read.fingerprint\n\t\t\t) {\n\t\t\t\treturn read;\n\t\t\t}\n\t\t}\n\n\t\tthis.cache.deleteGkConfigMap(repoPath);\n\t\treturn undefined;\n\t}\n\n\tprivate async getGkConfigRegexCore(\n\t\trepoPath: string,\n\t\tpattern: string,\n\t\tread: GkConfigMapRead,\n\t): Promise<{ map: Map<string, string>; failed: boolean }> {\n\t\tconst gkConfigPath = await this.getGkConfigPath(repoPath);\n\t\tif (!gkConfigPath) {\n\t\t\tread.spawned = true;\n\t\t\t// No `.git/gk/config` yet is a real answer, not a failure — a repo GitLens has never written to.\n\t\t\treturn { map: new Map(), failed: false };\n\t\t}\n\n\t\t// Taken before the spawn, never after: a write landing in between then only makes its report re-read the file.\n\t\t// The clock is read before the stat, so the stat is no earlier than the time it's checked against.\n\t\tread.path = gkConfigPath;\n\t\tread.fingerprint = getGkConfigFingerprint(gkConfigPath, gkConfigFingerprintClock.now());\n\t\tread.spawned = true;\n\t\tconst result = await this.git.run(\n\t\t\t{ cwd: repoPath, errors: 'ignore', runLocally: true },\n\t\t\t'config',\n\t\t\t'--get-regex',\n\t\t\t'-f',\n\t\t\tgkConfigPath,\n\t\t\tpattern,\n\t\t);\n\t\t// `--get-regex` exits 1 when nothing matches, which IS an answer (an empty gk config).\n\t\tconst exited = result.completion.status === 'exited';\n\t\treturn {\n\t\t\t// Deliberately NOT `.trim()`-ed — see `getConfigRegexCore`'s comment: it strips the trailing\n\t\t\t// space that marks an explicit-empty value's LAST line, silently dropping it from the map.\n\t\t\tmap: parseConfigRegexOutput(result.stdout),\n\t\t\tfailed: !exited || (result.exitCode !== 0 && result.exitCode !== 1),\n\t\t};\n\t}\n\n\t@debug()\n\tasync setGkConfig(\n\t\trepoPath: string,\n\t\tkey: GkConfigKeys | DeprecatedGkConfigKeys,\n\t\tvalue: string | undefined,\n\t\toptions?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },\n\t): Promise<void> {\n\t\t// A self-write (with skip targets) and a user-driven write of the same value have different invalidation\n\t\t// semantics, so only a matching skip option may join: otherwise the user-driven write would skip invalidation.\n\t\t// Sorted, so the same targets in any order match.\n\t\tconst commonPath = this.cache.getCommonPath(repoPath);\n\t\tconst skipKey = options?.skipInvalidation?.length ? options.skipInvalidation.toSorted().join(',') : '';\n\t\tconst pendingKey = `${commonPath}\\0${key}`;\n\n\t\tconst previous = this._pendingGkConfigWrites.get(pendingKey);\n\t\tif (previous != null && previous.value === value && previous.skipKey === skipKey) return previous.promise;\n\n\t\tconst promise =\n\t\t\tprevious != null\n\t\t\t\t? previous.promise.catch(() => {}).then(() => this.setGkConfigCore(repoPath, key, value, options))\n\t\t\t\t: this.setGkConfigCore(repoPath, key, value, options);\n\t\tconst pending = { value: value, skipKey: skipKey, promise: promise };\n\t\tthis._pendingGkConfigWrites.set(pendingKey, pending);\n\t\t// Swallow the cleanup chain's rejection so a failed write doesn't surface as an unhandled\n\t\t// rejection separate from the caller's own handling of the returned promise.\n\t\tvoid promise\n\t\t\t.finally(() => {\n\t\t\t\tif (this._pendingGkConfigWrites.get(pendingKey) === pending) {\n\t\t\t\t\tthis._pendingGkConfigWrites.delete(pendingKey);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(() => {});\n\t\treturn promise;\n\t}\n\n\tprivate async setGkConfigCore(\n\t\trepoPath: string,\n\t\tkey: GkConfigKeys | DeprecatedGkConfigKeys,\n\t\tvalue: string | undefined,\n\t\toptions?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },\n\t): Promise<void> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst gkConfigPath = await this.getGkConfigPath(repoPath);\n\t\tif (!gkConfigPath) return;\n\n\t\tconst gkConfigFolder = joinPaths(gkConfigPath, '..');\n\n\t\tif (!(await this.ensureGkConfigFolder(gkConfigFolder, scope))) return;\n\n\t\t// Seed the reconcile snapshot from the pre-write file, so the write below can tell whether it changed the\n\t\t// value (first tracked-key write per repository only; the bulk read is cached for everything else)\n\t\tif (this.cache.needsGkConfigSnapshot(repoPath, key)) {\n\t\t\tawait this.getGkConfigMap(repoPath);\n\t\t}\n\n\t\tawait this._gkConfigWrites.run(gkConfigPath, undefined, () =>\n\t\t\tthis.setConfigCore(repoPath, key, value, { file: gkConfigPath }),\n\t\t);\n\n\t\t// Invalidate the bulk map (so the next read re-fetches) and the derived caches for this key's\n\t\t// ref, then record the write, which fires `onDidChangeMergeTargets` when it changed a merge key —\n\t\t// except for a self-write (`skipInvalidation` given: an internal save while answering a read), which\n\t\t// nobody awaits; only another process's watcher reports that one.\n\t\t// The `.git/gk/config` file-watcher also fires `'gkConfig'` shortly after, which reconciles\n\t\t// the same change (see `reconcileGkConfig`) — recording our own write here keeps that later\n\t\t// reconcile from re-diffing this key as an external change.\n\t\tthis.cache.deleteGkConfig(repoPath, key, options);\n\t\tthis.cache.recordGkConfigWrite(repoPath, key, value, { announce: options?.skipInvalidation == null });\n\n\t\t// The watcher's report of this write can't reach the cached branches: the snapshot already holds the value\n\t\tconst metadataKey = parseBranchMetadataGkConfigKey(key);\n\t\tif (metadataKey != null) {\n\t\t\tthis.cache.patchBranchMetadata(repoPath, [\n\t\t\t\t{ branch: metadataKey.branch, key: metadataKey.key, value: value },\n\t\t\t]);\n\t\t}\n\t}\n\n\t@debug()\n\tasync removeGkConfigBranchSection(repoPath: string, ref: string): Promise<void> {\n\t\tif (await this.runGkConfigSectionCommand(repoPath, ref, '--remove-section', `branch.${ref}`)) {\n\t\t\tthis.cache.recordGkConfigSectionWrite(repoPath, ref);\n\t\t}\n\t}\n\n\t@debug()\n\tasync renameGkConfigBranchSection(repoPath: string, oldRef: string, newRef: string): Promise<void> {\n\t\t// Clear the destination first, unconditionally. `--rename-section` onto a section that already\n\t\t// exists APPENDS rather than replaces, leaving duplicate keys — and git resolves a duplicated key\n\t\t// to its LAST value, so the orphan left by an earlier branch of this name would win over the\n\t\t// metadata being moved. Doing this outside `runGkConfigSectionCommand` also covers the case where\n\t\t// the source has no gk keys at all, where its pre-check would otherwise skip the whole call and\n\t\t// leave the orphan in place for the renamed branch to inherit.\n\t\tawait this.removeGkConfigBranchSection(repoPath, newRef);\n\t\tif (\n\t\t\tawait this.runGkConfigSectionCommand(\n\t\t\t\trepoPath,\n\t\t\t\toldRef,\n\t\t\t\t'--rename-section',\n\t\t\t\t`branch.${oldRef}`,\n\t\t\t\t`branch.${newRef}`,\n\t\t\t)\n\t\t) {\n\t\t\tthis.cache.recordGkConfigSectionWrite(repoPath, oldRef, newRef);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a section-level `git config` against `.git/gk/config` for `ref`'s section, skipping the\n\t * subprocess entirely when the bulk map (already cached on any warm path) shows that ref has no gk\n\t * keys — the overwhelmingly common case, since most branches never get gk metadata written at all.\n\t *\n\t * Never throws: callers invoke this as bookkeeping after a branch op has already succeeded, so a\n\t * failure here must not be reported as (or roll back) the branch/checkout/worktree operation itself.\n\t * The worst case is metadata that stays behind until the next op on that name.\n\t *\n\t * Returns whether `.git/gk/config` now reflects the command (it ran, or there was nothing to do), so the\n\t * caller can record its own write in the reconcile snapshot only when it actually landed.\n\t */\n\tprivate async runGkConfigSectionCommand(repoPath: string, ref: string, ...args: string[]): Promise<boolean> {\n\t\tconst scope = getScopedLogger();\n\t\ttry {\n\t\t\tconst prefix = `branch.${ref}.`;\n\t\t\tconst map = await this.getGkConfigMap(repoPath);\n\t\t\t// The shortcut needs a map with CONTENT to be trustworthy. A failed bulk read resolves empty\n\t\t\t// (see `getGkConfigMap`) — the cache refuses it, but this caller still holds it — and an empty map\n\t\t\t// read as authoritative would skip the removal entirely, leaving a deleted branch's base,\n\t\t\t// disposition and issue links behind for the next branch reusing that name. When it's empty, run\n\t\t\t// the command: worst case is a no-op on a section that isn't there.\n\t\t\tif (map.size && !some(map.keys(), k => k.startsWith(prefix))) return true;\n\n\t\t\tconst gkConfigPath = await this.getGkConfigPath(repoPath);\n\t\t\tif (!gkConfigPath) return false;\n\t\t\t// `getGkConfigPath` only joins a path, so check the file: with no `.git/gk/config` there is\n\t\t\t// genuinely nothing to remove, and running the command would fail with a fatal we'd then warn\n\t\t\t// about on every branch delete in a repo that has never had gk metadata.\n\t\t\tif (!(await fsExists(gkConfigPath))) return true;\n\n\t\t\tconst result = await this._gkConfigWrites.run(gkConfigPath, undefined, () =>\n\t\t\t\tthis.git.run(\n\t\t\t\t\t{ cwd: repoPath, runLocally: true, errors: 'ignore' },\n\t\t\t\t\t'config',\n\t\t\t\t\t'-f',\n\t\t\t\t\tgkConfigPath,\n\t\t\t\t\t...args,\n\t\t\t\t),\n\t\t\t);\n\t\t\t// `errors: 'ignore'` is deliberate — see the note above on why this must never throw — but that\n\t\t\t// also means the `catch` below never sees a failed write, so without this the metadata silently\n\t\t\t// stays behind (or, on a rename, stays under the old name) with nothing recorded anywhere.\n\t\t\t// Reported, not thrown: the branch op it follows has already succeeded.\n\t\t\tconst succeeded = result.completion.status === 'exited' && result.exitCode === 0;\n\t\t\tif (!succeeded) {\n\t\t\t\tscope?.warn(\n\t\t\t\t\t`Failed to update gk config section for '${ref}' in '${repoPath}': ${\n\t\t\t\t\t\tresult.completion.status === 'exited'\n\t\t\t\t\t\t\t? `git config exited ${result.exitCode}`\n\t\t\t\t\t\t\t: `${result.completion.status} · ${result.completion.error.message}`\n\t\t\t\t\t}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// A whole section moved or vanished, which the per-key `deleteGkConfig` cascade can't express.\n\t\t\t// Drop the bulk map so the next read hits disk; the derived caches for the affected ref are\n\t\t\t// evicted by the caller's own `deleteBaseBranchName` plus the `'branches'` cascade it fires.\n\t\t\tthis.cache.deleteGkConfigMap(repoPath);\n\t\t\treturn succeeded;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, `Failed to update gk config section for '${ref}' in '${repoPath}'`);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Reconciles a watcher-observed `'gkConfig'` change — registered with the shared `Cache` as its\n\t * gk-config reconciler (see the constructor). Hard-evicts the bulk map as the change is reported, unless the file\n\t * is unchanged since the map was read (see `evictGkConfigMapIfChanged`), then reads it (from disk, or the map\n\t * kept) and diffs it against `priorSnapshot` to cascade\n\t * `baseBranchName`/`branchOverviews` only for refs whose merge-relevant keys actually changed, and to evict the\n\t * branches only when a branch metadata key (another process's activity stamp) changed. The diff runs on a kept\n\t * map too: a read can land between an external write and its report, and already hold the change.\n\t *\n\t * Serialized per commonPath: a reconcile is a read-then-diff against a single shared baseline, so\n\t * two overlapping passes would both diff against the same snapshot and the later change could fall\n\t * out entirely. An event arriving mid-pass instead queues one trailing pass, which re-reads and\n\t * diffs against the baseline the previous pass just established.\n\t *\n\t * `.git/gk/config` lives in the common dir, so the watcher delivers one event per worktree sharing it\n\t * (see `WatchGroup.onCommonEvent`), and core's own write is reported too. Siblings never run concurrently — the\n\t * later ones fold into the in-flight pass — but folding in arms the trailing pass, which re-diffs the map unless\n\t * the file changed again. However many siblings land while a pass is running, they coalesce into that single\n\t * trailing pass; the cost is the price of never dropping a real change.\n\t * Every reporting path is retained because `Repository` matches the follow-up change event on exact\n\t * path, and a sibling worktree that never receives one would sit on stale derived values.\n\t */\n\tprivate reconcileGkConfig(\n\t\trepoPath: string,\n\t\tpriorSnapshot: ReadonlyMap<string, string> | undefined,\n\t): GkReconcileOutcome | Promise<GkReconcileOutcome> {\n\t\tconst commonPath = this.cache.getCommonPath(repoPath);\n\n\t\tconst inflight = this._gkConfigReconciles.get(commonPath);\n\t\tif (inflight != null) {\n\t\t\t// Now, not in the trailing pass: a read between this report and that pass must see the change, and would\n\t\t\t// otherwise join the map read before it\n\t\t\tthis.evictGkConfigMapIfChanged(repoPath);\n\t\t\tinflight.paths.set(repoPath, this.cache.getCloseGeneration(repoPath));\n\t\t\tinflight.pending = true;\n\t\t\t// Handed to the in-flight pass's trailing loop, so it IS being reconciled — just not by this\n\t\t\t// call. Reporting a failure here would coarse-clear on every write in a burst.\n\t\t\treturn 'deferred';\n\t\t}\n\n\t\tconst entry = { pending: false, paths: new Map([[repoPath, this.cache.getCloseGeneration(repoPath)]]) };\n\t\tthis._gkConfigReconciles.set(commonPath, entry);\n\t\treturn this.runGkConfigReconcile(commonPath, priorSnapshot, entry);\n\t}\n\n\t/** Drops paths that closed since they reported the change; returns whichever remain. */\n\tprivate pruneClosedReconcilePaths(paths: Map<string, number>): Map<string, number> {\n\t\tfor (const [path, generation] of paths) {\n\t\t\tif (this.cache.getCloseGeneration(path) !== generation) {\n\t\t\t\tpaths.delete(path);\n\t\t\t}\n\t\t}\n\t\treturn paths;\n\t}\n\n\tprivate async runGkConfigReconcile(\n\t\tcommonPath: string,\n\t\tpriorSnapshot: ReadonlyMap<string, string> | undefined,\n\t\tentry: { pending: boolean; paths: Map<string, number> },\n\t): Promise<GkReconcileOutcome> {\n\t\tconst scope = getScopedLogger();\n\t\tlet snapshot = priorSnapshot;\n\n\t\ttry {\n\t\t\tdo {\n\t\t\t\tentry.pending = false;\n\n\t\t\t\t// Read through a path that's still open — one worktree closing must not drop the event for\n\t\t\t\t// its still-open siblings, which is why this reads from the surviving set rather than from\n\t\t\t\t// whichever path happened to report first.\n\t\t\t\tconst readPath = first(this.pruneClosedReconcilePaths(entry.paths).keys());\n\t\t\t\t// Every path that reported the change has since closed — nothing left to reconcile, and\n\t\t\t\t// nothing left holding a stale derived value either.\n\t\t\t\tif (readPath == null) return 'reconciled';\n\n\t\t\t\t// Runs before this pass's first await, so a first pass decides as the change is reported; a trailing one\n\t\t\t\t// re-checks the map the pass before it read\n\t\t\t\tconst kept = this.evictGkConfigMapIfChanged(readPath);\n\t\t\t\tlet freshMap = await this.getGkConfigMap(readPath);\n\t\t\t\t// A kept read that failed was started before this pass, which would otherwise have read the file\n\t\t\t\t// itself, so it gets one fresh read before the coarse fallback\n\t\t\t\tif (kept != null && failedGkConfigMaps.get(freshMap) === kept) {\n\t\t\t\t\tthis.cache.deleteGkConfigMap(readPath);\n\t\t\t\t\tfreshMap = await this.getGkConfigMap(readPath);\n\t\t\t\t}\n\t\t\t\t// A failed read diffed as the file's content would remove every key it missed\n\t\t\t\tif (failedGkConfigMaps.has(freshMap)) {\n\t\t\t\t\tthrow new Error(`Failed to read the gk config through '${readPath}'`);\n\t\t\t\t}\n\n\t\t\t\t// Paths may have closed while the re-read was in flight; if every one did, there's nothing\n\t\t\t\t// left to reconcile against.\n\t\t\t\tif (!this.pruneClosedReconcilePaths(entry.paths).size) return 'reconciled';\n\n\t\t\t\tif (this.cache.reconcileGkConfigMap(readPath, snapshot, freshMap)) {\n\t\t\t\t\t// Fire a follow-up change: a consumer that re-read on the original event may have done so\n\t\t\t\t\t// before this async cascade landed, so it would otherwise hold a stale derived value with\n\t\t\t\t\t// nothing left to prompt another re-read. Only the host hears it: it is not a write of\n\t\t\t\t\t// core's, and announcing it as one would evict the map just reconciled.\n\t\t\t\t\tfor (const path of entry.paths.keys()) {\n\t\t\t\t\t\tthis.provider.notifyHost(path, ['gkConfig']);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// `reconcileGkConfigMap` advanced the stored baseline to what we just read; a trailing pass\n\t\t\t\t// diffs its own read against that.\n\t\t\t\tsnapshot = this.cache.getGkConfigSnapshot(readPath);\n\t\t\t} while (entry.pending);\n\n\t\t\treturn 'reconciled';\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, `Failed to reconcile gk config for '${commonPath}'`);\n\t\t\t// The caller falls back to the coarse clear — derived caches are otherwise left holding\n\t\t\t// pre-change values with nothing to correct them.\n\t\t\treturn 'failed';\n\t\t} finally {\n\t\t\tthis._gkConfigReconciles.delete(commonPath);\n\t\t}\n\t}\n\n\t@debug()\n\tasync getSigningConfig(repoPath: string): Promise<SigningConfig> {\n\t\t// Fetch all signing-related config in one call\n\t\tconst configMap = await this.getConfigRegex(\n\t\t\trepoPath,\n\t\t\t'^(commit\\\\.gpgsign|gpg\\\\.format|user\\\\.signingkey|gpg\\\\.program|gpg\\\\.ssh\\\\.program|gpg\\\\.ssh\\\\.allowedsignersfile)$',\n\t\t);\n\n\t\t// Extract values (keys are lowercase in git output)\n\t\tconst enabledRaw = configMap.get('commit.gpgsign');\n\t\tconst format = configMap.get('gpg.format');\n\t\tconst signingKey = configMap.get('user.signingkey');\n\t\tconst gpgProgram = configMap.get('gpg.program');\n\t\tconst sshProgram = configMap.get('gpg.ssh.program');\n\t\tconst allowedSignersFile = configMap.get('gpg.ssh.allowedsignersfile');\n\n\t\t// Check if git config has commit signing enabled, falling back to the host-level override\n\t\t// (e.g. VS Code's `git.enableCommitSigning`) when `commit.gpgsign` is unset/false. The host\n\t\t// override can only enable signing, never force it off.\n\t\tconst isEnabled = parseGitBoolean(enabledRaw) || this.context.config?.signing?.enabled === true;\n\n\t\treturn {\n\t\t\tenabled: isEnabled,\n\t\t\tformat: (format as SigningFormat) ?? 'gpg',\n\t\t\tsigningKey: signingKey,\n\t\t\tgpgProgram: gpgProgram,\n\t\t\tsshProgram: sshProgram,\n\t\t\tallowedSignersFile: allowedSignersFile,\n\t\t};\n\t}\n\n\t@debug()\n\tasync validateSigningSetup(repoPath: string): Promise<ValidationResult> {\n\t\tconst config = await this.getSigningConfig(repoPath);\n\n\t\tif (!config.signingKey) {\n\t\t\treturn { valid: false, error: 'No signing key configured' };\n\t\t}\n\n\t\t// Basic validation: just check that a signing key is configured\n\t\t// Git will handle the actual validation when signing commits\n\t\treturn { valid: true };\n\t}\n\n\t@debug()\n\tasync setSigningConfig(\n\t\trepoPath: string,\n\t\tconfig: Partial<SigningConfig>,\n\t\toptions?: { global?: boolean },\n\t): Promise<void> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst entries: [GitConfigKeys, string][] = [];\n\t\tif (config.enabled != null) {\n\t\t\tentries.push(['commit.gpgsign', config.enabled ? 'true' : 'false']);\n\t\t}\n\t\tif (config.format != null) {\n\t\t\tentries.push(['gpg.format', config.format]);\n\t\t}\n\t\tif (config.signingKey != null) {\n\t\t\tentries.push(['user.signingkey', config.signingKey]);\n\t\t}\n\t\tif (config.gpgProgram != null) {\n\t\t\tentries.push(['gpg.program', config.gpgProgram]);\n\t\t}\n\t\tif (config.sshProgram != null) {\n\t\t\tentries.push(['gpg.ssh.program', config.sshProgram]);\n\t\t}\n\t\tif (config.allowedSignersFile != null) {\n\t\t\tentries.push(['gpg.ssh.allowedSignersFile', config.allowedSignersFile]);\n\t\t}\n\n\t\tlet wrote = false;\n\t\ttry {\n\t\t\tfor (const [key, value] of entries) {\n\t\t\t\tawait this.setConfigCore(repoPath, key, value, options);\n\t\t\t\twrote = true;\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tthrow ex;\n\t\t} finally {\n\t\t\t// One `config` announcement for the keys written, rather than one (each fanned out to every worktree) per key\n\t\t\tif (wrote && !options?.global) {\n\t\t\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['config']);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetSigningConfigFlags(config: SigningConfig): string[] {\n\t\tconst flags: string[] = [];\n\n\t\tif (config.gpgProgram) {\n\t\t\tflags.push('-c', `gpg.program=${config.gpgProgram}`);\n\t\t}\n\t\tif (config.format && config.format !== 'gpg') {\n\t\t\tflags.push('-c', `gpg.format=${config.format}`);\n\t\t}\n\t\tif (config.sshProgram) {\n\t\t\tflags.push('-c', `gpg.ssh.program=${config.sshProgram}`);\n\t\t}\n\t\tif (config.allowedSignersFile) {\n\t\t\tflags.push('-c', `gpg.ssh.allowedSignersFile=${config.allowedSignersFile}`);\n\t\t}\n\n\t\treturn flags;\n\t}\n\n\tasync getRepositoryInfo(\n\t\tcwd: string,\n\t): Promise<\n\t\t| { repoPath: string; gitDir: string; commonGitDir: string | undefined; superprojectPath: string | undefined }\n\t\t| [safe: true, repoPath: string]\n\t\t| [safe: false]\n\t\t| []\n\t> {\n\t\tlet result;\n\n\t\tif (this.context.workspace?.isTrusted === false) {\n\t\t\ttry {\n\t\t\t\tawait fs.stat(joinPaths(cwd, 'HEAD'));\n\t\t\t\tresult = await this.git.run(\n\t\t\t\t\t{ cwd: cwd, errors: 'throw', configs: ['-C', cwd] },\n\t\t\t\t\t'rev-parse',\n\t\t\t\t\t'--show-cdup',\n\t\t\t\t);\n\t\t\t\tif (!result.stdout.trim()) {\n\t\t\t\t\tLogger.warn(`Skipping (untrusted); bare clone repository detected in '${cwd}'`);\n\t\t\t\t\treturn emptyArray as [];\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// If this throws, we should be good to open the repo\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tresult = await this.git.run(\n\t\t\t\t{ cwd: cwd, errors: 'throw' },\n\t\t\t\t'rev-parse',\n\t\t\t\t'--show-toplevel',\n\t\t\t\t'--git-dir',\n\t\t\t\t'--git-common-dir',\n\t\t\t\t'--show-superproject-working-tree',\n\t\t\t);\n\t\t\tif (!result.stdout) return emptyArray as [];\n\n\t\t\t// Output is 3-4 lines: show-toplevel, git-dir, git-common-dir, [show-superproject-working-tree]\n\t\t\t// The 4th line is only present for submodules\n\t\t\tconst lines = result.stdout.split('\\n').map(r => r.trimStart());\n\t\t\tconst [repoPath, dotGitPath, commonDotGitPath, superprojectPath] = lines;\n\n\t\t\tif (!repoPath) return emptyArray as [];\n\n\t\t\tconst normalizedRepoPath = normalizePath(repoPath.replace(/[\\r|\\n]+$/, ''));\n\n\t\t\tlet gitDir = dotGitPath;\n\t\t\tif (gitDir && !isAbsolute(gitDir)) {\n\t\t\t\tgitDir = joinPaths(cwd, gitDir);\n\t\t\t}\n\t\t\tgitDir = normalizePath(gitDir);\n\n\t\t\tlet commonGitDir: string | undefined;\n\t\t\tif (commonDotGitPath) {\n\t\t\t\tcommonGitDir = commonDotGitPath;\n\t\t\t\tif (!isAbsolute(commonGitDir)) {\n\t\t\t\t\tcommonGitDir = joinPaths(cwd, commonGitDir);\n\t\t\t\t}\n\t\t\t\tcommonGitDir = normalizePath(commonGitDir);\n\t\t\t\tif (commonGitDir === gitDir) {\n\t\t\t\t\tcommonGitDir = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trepoPath: normalizedRepoPath,\n\t\t\t\tgitDir: gitDir,\n\t\t\t\tcommonGitDir: commonGitDir,\n\t\t\t\tsuperprojectPath: superprojectPath?.trim() || undefined,\n\t\t\t};\n\t\t} catch (ex: any) {\n\t\t\tif (ex instanceof WorkspaceUntrustedError) return emptyArray as [];\n\n\t\t\tconst unsafeMatch =\n\t\t\t\t/(?:^fatal:\\s*detected dubious ownership in repository at '([^']+)'|unsafe repository \\('([^']+)' is owned by someone else\\))[\\s\\S]*(git config --global --add safe\\.directory [^\\n\\u2022]+)/m.exec(\n\t\t\t\t\tex.stderr,\n\t\t\t\t);\n\t\t\tif (unsafeMatch != null) {\n\t\t\t\tLogger.warn(\n\t\t\t\t\t`Skipping; unsafe repository detected in '${unsafeMatch[1] || unsafeMatch[2]}'; run '${\n\t\t\t\t\t\tunsafeMatch[3]\n\t\t\t\t\t}' to allow it`,\n\t\t\t\t);\n\t\t\t\treturn [false];\n\t\t\t}\n\n\t\t\tconst inDotGit = /this operation must be run in a work tree/.test(ex.stderr);\n\t\t\tif (inDotGit && this.context.workspace?.isTrusted !== false) {\n\t\t\t\tresult = await this.git.run({ cwd: cwd, errors: 'ignore' }, 'rev-parse', '--is-bare-repository');\n\t\t\t\tif (result.stdout.trim() === 'true') {\n\t\t\t\t\tconst result = await this.revParseGitDir(cwd);\n\t\t\t\t\tconst repoPath = result?.commonPath ?? result?.path;\n\t\t\t\t\tif (repoPath?.length) return [true, repoPath];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (inDotGit || ex.code === 'ENOENT') {\n\t\t\t\tlet exists = inDotGit ? false : await fsExists(cwd);\n\t\t\t\tif (!exists) {\n\t\t\t\t\tdo {\n\t\t\t\t\t\tconst parent = dirname(cwd);\n\t\t\t\t\t\tif (parent === cwd || parent.length === 0) return emptyArray as [];\n\n\t\t\t\t\t\tcwd = parent;\n\t\t\t\t\t\texists = await fsExists(cwd);\n\t\t\t\t\t} while (!exists);\n\n\t\t\t\t\treturn this.getRepositoryInfo(cwd);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn emptyArray as [];\n\t\t}\n\t}\n\n\tprivate async revParseGitDir(cwd: string): Promise<{ path: string; commonPath?: string } | undefined> {\n\t\tconst result = await this.git.run({ cwd: cwd, errors: 'ignore' }, 'rev-parse', '--git-dir', '--git-common-dir');\n\t\tif (!result.stdout) return undefined;\n\n\t\tlet [dotGitPath, commonDotGitPath] = result.stdout.split('\\n').map(r => r.trimStart());\n\n\t\tif (!isAbsolute(dotGitPath)) {\n\t\t\tdotGitPath = joinPaths(cwd, dotGitPath);\n\t\t}\n\t\tdotGitPath = normalizePath(dotGitPath);\n\n\t\tif (commonDotGitPath) {\n\t\t\tif (!isAbsolute(commonDotGitPath)) {\n\t\t\t\tcommonDotGitPath = joinPaths(cwd, commonDotGitPath);\n\t\t\t}\n\t\t\tcommonDotGitPath = normalizePath(commonDotGitPath);\n\n\t\t\treturn { path: dotGitPath, commonPath: commonDotGitPath !== dotGitPath ? commonDotGitPath : undefined };\n\t\t}\n\n\t\treturn { path: dotGitPath };\n\t}\n\n\t/**\n\t * Ensures the `.git/gk/` folder exists, but only if the parent `.git` directory already exists.\n\t * This prevents creating stray `.git` directories if the computed path is wrong.\n\t * Returns `true` if the folder was ensured, `false` if the parent `.git` does not exist.\n\t */\n\tprivate async ensureGkConfigFolder(\n\t\tgkConfigFolder: string,\n\t\tscope: ReturnType<typeof getScopedLogger>,\n\t): Promise<boolean> {\n\t\t// Verify the .git directory already exists — never create it from scratch\n\t\tconst dotGitDir = joinPaths(gkConfigFolder, '..');\n\t\ttry {\n\t\t\tawait fs.stat(dotGitDir);\n\t\t} catch {\n\t\t\tscope?.warn(`Skipping GK config write — expected git directory '${dotGitDir}' does not exist`);\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\tawait fs.mkdir(gkConfigFolder, { recursive: true });\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, `Failed to create '${gkConfigFolder}' directory`);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate _migratedRepos = new Set<string>();\n\n\t/**\n\t * One-time migration of GK config entries from regular git config to `.git/gk/config`.\n\t * If `.git/gk/config` already exists, assumes migration is complete (or data is already there).\n\t * Preserves existing `.git/gk/config` values as source of truth (won't overwrite).\n\t * Removes migrated keys from regular git config to stop cluttering it.\n\t */\n\t@gate()\n\t@debug()\n\tprivate async migrateGkConfigFromGitConfig(repoPath: string): Promise<void> {\n\t\tif (this._migratedRepos.has(repoPath)) return;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst gkConfigPath = await this.getGkConfigPath(repoPath);\n\t\tif (!gkConfigPath) {\n\t\t\tthis._migratedRepos.add(repoPath);\n\t\t\treturn;\n\t\t}\n\n\t\tconst gkConfigFolder = joinPaths(gkConfigPath, '..');\n\n\t\t// If .git/gk/config already exists, consider migration done — it was either\n\t\t// already migrated or values were written there directly via setGkConfig\n\t\ttry {\n\t\t\tawait fs.stat(gkConfigPath);\n\t\t\tthis._migratedRepos.add(repoPath);\n\t\t\treturn;\n\t\t} catch {\n\t\t\t// file doesn't exist, proceed with migration\n\t\t}\n\n\t\t// If .git/gk/config doesn't exist, create an empty file to prevent multiple migration attempts in future sessions\n\t\tif (!(await this.ensureGkConfigFolder(gkConfigFolder, scope))) return;\n\n\t\ttry {\n\t\t\tawait fs.writeFile(gkConfigPath, new Uint8Array());\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, `Failed to create '${gkConfigPath}' file`);\n\t\t}\n\n\t\t// Read legacy gk-* keys from regular git config\n\t\tlet migrateConfig: Map<string, string>;\n\t\ttry {\n\t\t\tmigrateConfig = await this.getConfigRegexCore(repoPath, '^branch\\\\..*\\\\.gk-', { runGitLocally: true });\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex, 'Failed to read legacy GK config entries');\n\t\t\tthis._migratedRepos.add(repoPath);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!migrateConfig.size) {\n\t\t\tthis._migratedRepos.add(repoPath);\n\t\t\treturn;\n\t\t}\n\n\t\tscope?.info(`Migrating ${String(migrateConfig.size)} GK config entries from git config to .git/gk/config`);\n\n\t\t// Copy legacy entries to .git/gk/config\n\t\tfor (const [key, value] of [...migrateConfig]) {\n\t\t\ttry {\n\t\t\t\tawait this._gkConfigWrites.run(gkConfigPath, undefined, () =>\n\t\t\t\t\tthis.setConfigCore(repoPath, key, value, { file: gkConfigPath }),\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex, `Failed to migrate key '${key}' to GK config`);\n\t\t\t\t// If we failed to migrate, delete it from the list so we won't try to remove it from git config later\n\t\t\t\tmigrateConfig.delete(key);\n\t\t\t}\n\t\t}\n\n\t\t// Remove legacy keys from regular git config (use --unset-all defensively)\n\t\tfor (const [key] of migrateConfig) {\n\t\t\ttry {\n\t\t\t\tawait this.git.run(\n\t\t\t\t\t{ cwd: repoPath, errors: 'ignore', runLocally: true },\n\t\t\t\t\t'config',\n\t\t\t\t\t'--local',\n\t\t\t\t\t'--unset-all',\n\t\t\t\t\tkey,\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex, `Failed to remove migrated key '${key}' from git config`);\n\t\t\t}\n\t\t}\n\n\t\t// Clear caches since we modified both config files\n\t\tthis.cache.clearCaches(repoPath, 'config', 'gkConfig');\n\n\t\tthis._migratedRepos.add(repoPath);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6BA,MAAM,oBAAoB;AAC1B,MAAM,aAA+B,OAAO,OAAO,CAAC,CAAC;;AAGrD,MAAM,qBAAqB;;;;;;AAO3B,MAAM,qCAAqB,IAAI,QAA8C;;;;;;AAgB7E,MAAM,mCAAmB,IAAI,QAA6C;;AAG1E,MAAa,2BAA2B,EAAE,WAAmB,KAAK,IAAI,EAAE;AAExE,MAAM,UAAU;AAChB,MAAM,cAAc;;;;;;;;;;;AAYpB,SAAgB,mBAAmB,SAAiB,SAAiB,YAA6B;CACjG,MAAM,YAAY,UAAU,UAAU,UAAU;CAChD,MAAM,WAAW,UAAU,gBAAgB,MAAM,UAAU,gBAAgB,KAAK,KAAK,cAAc,MAAM;CACzG,OAAO,OAAO,KAAK,MAAM,UAAU,CAAC,IAAI,UAAU,YAAY;AAC/D;;;;;;;;;AAUA,SAAS,uBAAuB,MAA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,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,qBAAA,IAAA;AAgDN,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,aAAA,IAAA;AAoDN,WAAA,CAAA,KAAK,GACL,MAAM,CAAA,GAAA,qBAAA,WAAA,kBAAA,IAAA;AA0DN,WAAA,CAAA,KAAK,GACL,MAAM,EAAE,OAAM,MAAK,YAAY,IAAI,CAAC,CAAA,GAAA,qBAAA,WAAA,0BAAA,IAAA;AASpC,WAAA,CAAA,KAAK,GACL,MAAM,EACN,OAAM,MACL,YAAY,EAAE,IAAI,SAAS,IAAI,EAAE,cAAc,EAAE,WAAW,SAAS,IAAI,EAAE,cAAc,EAAE,WAAW,SAAS,IAAI,IACrH,CAAC,CAAA,GAAA,qBAAA,WAAA,aAAA,IAAA;AA8CA,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,eAAA,IAAA;AASN,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,oBAAA,IAAA;AA0HN,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,eAAA,IAAA;AA+EN,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,+BAAA,IAAA;AAON,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,+BAAA,IAAA;AA+MN,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,oBAAA,IAAA;AA+BN,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,wBAAA,IAAA;AAaN,WAAA,CAAA,MAAM,CAAA,GAAA,qBAAA,WAAA,oBAAA,IAAA;AA8ON,WAAA,CAAA,KAAK,GACL,MAAM,CAAA,GAAA,qBAAA,WAAA,gCAAA,IAAA"}
@@ -60,6 +60,29 @@ export declare class OperationsGitSubProvider implements GitOperationsSubProvide
60
60
  * repository), else the sole remote, else `origin`
61
61
  */
62
62
  private getDefaultFetchRemote;
63
+ /**
64
+ * The for-each-ref patterns covering every ref a fetch from `remote` (`undefined`: from any remote) may write: the
65
+ * destinations of `refspecs`, those of the remote's configured `remote.<name>.fetch` refspecs (which a fetch of
66
+ * explicit refspecs still updates opportunistically, and which may store into local branches, as a mirror's do),
67
+ * and tags. A `remote` with no refspecs of its own may be a remote group (`remotes.<group>`), which fetches each of
68
+ * its remotes, so every remote's destinations stand for it. When the configuration can't be read, all local and
69
+ * remote-tracking branches stand for the configured destinations.
70
+ */
71
+ private getFetchSnapshotPatterns;
72
+ /**
73
+ * Announces what a fetch moved. Its refs are compared with the snapshot taken before it ran, so a fetch that
74
+ * brought nothing new announces nothing (and resets nothing), and one that did names exactly the refs it moved,
75
+ * letting every worktree that doesn't track them skip its refresh. When either snapshot is missing, it announces
76
+ * `fallback()`'s kinds unnamed, as if every ref of them may have moved; when a ref moved outside the kinds an
77
+ * announcement can name (`refs/notes/*`), the kinds it did see, together with `fallback()`'s, unnamed.
78
+ */
79
+ private announceFetch;
80
+ /**
81
+ * Each ref under `patterns` (for-each-ref patterns) with its object and, for a symbolic ref, its target (a remote's
82
+ * `HEAD` can move to another branch at the same commit), or `undefined` when git couldn't answer. A read, so it
83
+ * announces nothing.
84
+ */
85
+ private snapshotRefs;
63
86
  /** `remotes`, plus `heads`/`tags` for any local branch or tag the fetch writes — a `pull` fetch writes `<upstream>:<branch>` */
64
87
  private getFetchChanges;
65
88
  private fetchCore;
@@ -121,8 +144,19 @@ export declare class OperationsGitSubProvider implements GitOperationsSubProvide
121
144
  * the final default.
122
145
  */
123
146
  private throwIfSigningError;
124
- /** Called once git has run, success or not — a rejected write can still have moved HEAD or left state behind */
147
+ /**
148
+ * Called once git has run, success or not — a rejected write can still have moved HEAD or left state behind.
149
+ * `branchRef` is the full name of the one branch the write could have moved, when it knows it; `wroteTracking`
150
+ * says it wrote that branch's tracking, to its own config section.
151
+ */
125
152
  private announceHeadChanged;
153
+ /**
154
+ * The full name of the branch HEAD is on, from the worktree's own `HEAD` file (`ref: refs/heads/main`): read around
155
+ * a write, so it names the branch that write moved, whatever a switch outside core left in the caches; no git
156
+ * runs. `undefined` when HEAD is detached, unreadable, or not a branch name git allows — a reftable repository's
157
+ * `HEAD` file holds the placeholder `refs/heads/.invalid`, and its real HEAD is in the tables.
158
+ */
159
+ private readHeadBranchRef;
126
160
  /** The caller has already announced the change — the conflict is what the failed run left behind */
127
161
  private createConflictResult;
128
162
  }