@gitkraken/core-gitlens 0.37.1 → 0.38.1

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 (116) hide show
  1. package/CHANGELOG.md +69 -1
  2. package/dist/git/cache.d.ts +128 -8
  3. package/dist/git/cache.js +425 -46
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/features.d.ts +1 -1
  6. package/dist/git/features.js +3 -0
  7. package/dist/git/features.js.map +1 -1
  8. package/dist/git/providers/branches.d.ts +42 -1
  9. package/dist/git/providers/diff.d.ts +17 -0
  10. package/dist/git/providers/provider.d.ts +7 -0
  11. package/dist/git/providers/shared/remotes.js +8 -4
  12. package/dist/git/providers/shared/remotes.js.map +1 -1
  13. package/dist/git/remotes/matcher.js +2 -2
  14. package/dist/git/remotes/matcher.js.map +1 -1
  15. package/dist/git/repositoryService.d.ts +16 -1
  16. package/dist/git/repositoryService.js +51 -3
  17. package/dist/git/repositoryService.js.map +1 -1
  18. package/dist/git/run.types.d.ts +1 -0
  19. package/dist/git/service.js +6 -2
  20. package/dist/git/service.js.map +1 -1
  21. package/dist/git/utils/fileStatus.utils.d.ts +5 -0
  22. package/dist/git/utils/fileStatus.utils.js +18 -1
  23. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  24. package/dist/git/watching/changeEvent.d.ts +13 -3
  25. package/dist/git/watching/changeEvent.js +15 -4
  26. package/dist/git/watching/changeEvent.js.map +1 -1
  27. package/dist/git/watching/changeOrdinal.d.ts +9 -0
  28. package/dist/git/watching/changeOrdinal.js +14 -0
  29. package/dist/git/watching/changeOrdinal.js.map +1 -0
  30. package/dist/git/watching/unwatchedCacheValidator.d.ts +38 -5
  31. package/dist/git/watching/unwatchedCacheValidator.js +180 -36
  32. package/dist/git/watching/unwatchedCacheValidator.js.map +1 -1
  33. package/dist/git/watching/watchGroup.d.ts +63 -14
  34. package/dist/git/watching/watchGroup.js +213 -74
  35. package/dist/git/watching/watchGroup.js.map +1 -1
  36. package/dist/git/watching/watchService.js +4 -3
  37. package/dist/git/watching/watchService.js.map +1 -1
  38. package/dist/git/watching/watchSession.d.ts +10 -2
  39. package/dist/git/watching/watchSession.js +18 -4
  40. package/dist/git/watching/watchSession.js.map +1 -1
  41. package/dist/git/watching/watcherPatterns.d.ts +18 -4
  42. package/dist/git/watching/watcherPatterns.js +39 -8
  43. package/dist/git/watching/watcherPatterns.js.map +1 -1
  44. package/dist/git/watching/worktreeSummary.d.ts +23 -12
  45. package/dist/git/watching/worktreeSummary.js +164 -41
  46. package/dist/git/watching/worktreeSummary.js.map +1 -1
  47. package/dist/git-cli/cliGitProvider.d.ts +1 -0
  48. package/dist/git-cli/cliGitProvider.js +11 -2
  49. package/dist/git-cli/cliGitProvider.js.map +1 -1
  50. package/dist/git-cli/exec/git.d.ts +7 -2
  51. package/dist/git-cli/exec/git.js +46 -10
  52. package/dist/git-cli/exec/git.js.map +1 -1
  53. package/dist/git-cli/exec/headState.d.ts +24 -0
  54. package/dist/git-cli/exec/headState.js +46 -6
  55. package/dist/git-cli/exec/headState.js.map +1 -1
  56. package/dist/git-cli/parsers/logParser.js +6 -3
  57. package/dist/git-cli/parsers/logParser.js.map +1 -1
  58. package/dist/git-cli/providers/branches.d.ts +135 -10
  59. package/dist/git-cli/providers/branches.js +622 -80
  60. package/dist/git-cli/providers/branches.js.map +1 -1
  61. package/dist/git-cli/providers/commits.d.ts +16 -0
  62. package/dist/git-cli/providers/commits.js +80 -28
  63. package/dist/git-cli/providers/commits.js.map +1 -1
  64. package/dist/git-cli/providers/config.d.ts +10 -0
  65. package/dist/git-cli/providers/config.js +50 -12
  66. package/dist/git-cli/providers/config.js.map +1 -1
  67. package/dist/git-cli/providers/contributors.js +11 -7
  68. package/dist/git-cli/providers/contributors.js.map +1 -1
  69. package/dist/git-cli/providers/diff.d.ts +12 -0
  70. package/dist/git-cli/providers/diff.js +107 -15
  71. package/dist/git-cli/providers/diff.js.map +1 -1
  72. package/dist/git-cli/providers/graph.js +32 -25
  73. package/dist/git-cli/providers/graph.js.map +1 -1
  74. package/dist/git-cli/providers/operations.d.ts +37 -3
  75. package/dist/git-cli/providers/operations.js +124 -46
  76. package/dist/git-cli/providers/operations.js.map +1 -1
  77. package/dist/git-cli/providers/patch.js +1 -1
  78. package/dist/git-cli/providers/patch.js.map +1 -1
  79. package/dist/git-cli/providers/refs.d.ts +1 -1
  80. package/dist/git-cli/providers/refs.js +10 -11
  81. package/dist/git-cli/providers/refs.js.map +1 -1
  82. package/dist/git-cli/providers/status.d.ts +4 -5
  83. package/dist/git-cli/providers/status.js +36 -33
  84. package/dist/git-cli/providers/status.js.map +1 -1
  85. package/dist/git-cli/providers/tags.d.ts +8 -0
  86. package/dist/git-cli/providers/tags.js +53 -34
  87. package/dist/git-cli/providers/tags.js.map +1 -1
  88. package/dist/git-cli/service.d.ts +15 -0
  89. package/dist/git-cli/service.js +19 -1
  90. package/dist/git-cli/service.js.map +1 -1
  91. package/dist/plus/git-github/providers/github/diff.d.ts +1 -0
  92. package/dist/plus/git-github/providers/github/diff.js +6 -1
  93. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  94. package/dist/plus/integrations/integrationService.js +9 -0
  95. package/dist/plus/integrations/integrationService.js.map +1 -1
  96. package/dist/plus/integrations/providers/jira-server.js +1 -1
  97. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  98. package/dist/plus/integrations/providers/jira.d.ts +20 -9
  99. package/dist/plus/integrations/providers/jira.js +114 -99
  100. package/dist/plus/integrations/providers/jira.js.map +1 -1
  101. package/dist/plus/integrations/providers/linear.d.ts +11 -4
  102. package/dist/plus/integrations/providers/linear.js +75 -32
  103. package/dist/plus/integrations/providers/linear.js.map +1 -1
  104. package/dist/plus/integrations/providers/utils/discoveryCache.d.ts +35 -4
  105. package/dist/plus/integrations/providers/utils/discoveryCache.js +45 -11
  106. package/dist/plus/integrations/providers/utils/discoveryCache.js.map +1 -1
  107. package/dist/utils/env/node/exec.d.ts +8 -4
  108. package/dist/utils/env/node/exec.js +115 -9
  109. package/dist/utils/env/node/exec.js.map +1 -1
  110. package/dist/utils/holdOffMap.d.ts +23 -0
  111. package/dist/utils/holdOffMap.js +43 -0
  112. package/dist/utils/holdOffMap.js.map +1 -0
  113. package/dist/utils/promiseCache.d.ts +15 -2
  114. package/dist/utils/promiseCache.js +34 -4
  115. package/dist/utils/promiseCache.js.map +1 -1
  116. package/package.json +1 -1
@@ -23,44 +23,23 @@ var TagsGitSubProvider = class {
23
23
  this.provider = provider;
24
24
  }
25
25
  async getTag(repoPath, name, cancellation) {
26
- const { values: [tag] } = await this.getTags(repoPath, { filter: (t) => t.name === name }, cancellation);
27
- return tag;
26
+ if (!repoPath) return void 0;
27
+ const { values } = await this.getSharedTags(repoPath, cancellation);
28
+ return values.find((t) => t.name === name)?.withRepoPath(repoPath);
29
+ }
30
+ /**
31
+ * Whether `getTags(repoPath)` holds a tag `matches` accepts (any when omitted), judged on each as that list would
32
+ * hold it, without keeping that worktree's copy of the list
33
+ */
34
+ async hasTag(repoPath, matches, cancellation) {
35
+ if (!repoPath) return false;
36
+ const { values } = await this.getSharedTags(repoPath, cancellation);
37
+ return matches == null ? values.length !== 0 : values.some((t) => matches(t.withRepoPath(repoPath)));
28
38
  }
29
39
  async getTags(repoPath, options, cancellation) {
30
40
  if (!repoPath) return emptyPagedResult;
31
41
  const scope = getScopedLogger();
32
- let tagsResult = await this.cache.getTags(repoPath, async (commonPath, _cacheable, signal) => {
33
- signal ??= cancellation;
34
- try {
35
- try {
36
- var _usingCtx$1 = _usingCtx();
37
- const records = await this.provider.refs.getRefs(commonPath, signal);
38
- if (!records.length) return emptyPagedResult;
39
- const sw = _usingCtx$1.u(maybeStopWatch(scope, { log: {
40
- onlyExit: true,
41
- level: "debug"
42
- } }));
43
- const tags = [];
44
- for (const record of records) {
45
- const fullName = record.name;
46
- if (!fullName.startsWith("refs/tags/")) continue;
47
- const annotated = Boolean(record.peeledObjectname);
48
- const sha = record.peeledObjectname || record.objectname;
49
- tags.push(new GitTag(commonPath, fullName, sha, record.subject, record.creatorDate ? new Date(record.creatorDate) : void 0, record.authorDate ? new Date(record.authorDate) : void 0, annotated));
50
- }
51
- sw?.stop({ suffix: ` parsed ${String(tags.length)} tags` });
52
- return { values: tags };
53
- } catch (_) {
54
- _usingCtx$1.e = _;
55
- } finally {
56
- _usingCtx$1.d();
57
- }
58
- } catch (ex) {
59
- scope?.error(ex);
60
- if (isCancellationError(ex)) throw ex;
61
- return emptyPagedResult;
62
- }
63
- }, cancellation);
42
+ let tagsResult = await this.cache.getTags(repoPath, (commonPath, cacheable, signal) => this.readTags(commonPath, cacheable, signal ?? cancellation, scope), cancellation);
64
43
  if (options?.filter != null) tagsResult = {
65
44
  ...tagsResult,
66
45
  values: tagsResult.values.filter(options.filter)
@@ -68,6 +47,46 @@ var TagsGitSubProvider = class {
68
47
  if (options?.sort) sortTags(tagsResult.values, typeof options.sort === "boolean" ? void 0 : options.sort);
69
48
  return tagsResult;
70
49
  }
50
+ /** The tags every worktree of `repoPath` shares, listed from the common path, read once whoever asks */
51
+ getSharedTags(repoPath, cancellation) {
52
+ const scope = getScopedLogger();
53
+ return this.cache.getSharedTags(repoPath, (commonPath, cacheable, signal) => this.readTags(commonPath, cacheable, signal ?? cancellation, scope), cancellation);
54
+ }
55
+ async readTags(commonPath, cacheable, signal, scope) {
56
+ try {
57
+ try {
58
+ var _usingCtx$1 = _usingCtx();
59
+ const records = await this.provider.refs.getRefs(commonPath, signal);
60
+ if (!records.length) {
61
+ cacheable.invalidate();
62
+ return emptyPagedResult;
63
+ }
64
+ const sw = _usingCtx$1.u(maybeStopWatch(scope, { log: {
65
+ onlyExit: true,
66
+ level: "debug"
67
+ } }));
68
+ const tags = [];
69
+ for (const record of records) {
70
+ const fullName = record.name;
71
+ if (!fullName.startsWith("refs/tags/")) continue;
72
+ const annotated = Boolean(record.peeledObjectname);
73
+ const sha = record.peeledObjectname || record.objectname;
74
+ tags.push(new GitTag(commonPath, fullName, sha, record.subject, record.creatorDate ? new Date(record.creatorDate) : void 0, record.authorDate ? new Date(record.authorDate) : void 0, annotated));
75
+ }
76
+ sw?.stop({ suffix: ` parsed ${String(tags.length)} tags` });
77
+ return { values: tags };
78
+ } catch (_) {
79
+ _usingCtx$1.e = _;
80
+ } finally {
81
+ _usingCtx$1.d();
82
+ }
83
+ } catch (ex) {
84
+ cacheable.invalidate();
85
+ scope?.error(ex);
86
+ if (isCancellationError(ex)) throw ex;
87
+ return emptyPagedResult;
88
+ }
89
+ }
71
90
  async getTagsWithCommit(repoPath, sha, options, cancellation) {
72
91
  const result = await this.tagsContainingCore(repoPath, sha, options, cancellation);
73
92
  if (!result.stdout) return [];
@@ -1 +1 @@
1
- {"version":3,"file":"tags.js","names":[],"sources":["../../../../git-cli/src/providers/tags.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport { TagError } from '@gitlens/git/errors.js';\nimport { GitTag } from '@gitlens/git/models/tag.js';\nimport type { GitTagsSubProvider } from '@gitlens/git/providers/tags.js';\nimport type { TagSortOptions } from '@gitlens/git/utils/sorting.js';\nimport { sortTags } from '@gitlens/git/utils/sorting.js';\nimport { ensureArray, filterMap } from '@gitlens/utils/array.js';\nimport { isCancellationError } from '@gitlens/utils/cancellation.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport type { PagedResult, PagingOptions } from '@gitlens/utils/paging.js';\nimport { emptyPagedResult } from '@gitlens/utils/paging.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport type { CliGitProviderInternal } from '../cliGitProvider.js';\nimport type { GitResult } from '../exec/exec.types.js';\nimport type { Git, GitError } from '../exec/git.js';\nimport { getGitCommandError, gitConfigsBranch } from '../exec/git.js';\n\nexport class TagsGitSubProvider implements GitTagsSubProvider {\n\tconstructor(\n\t\tprivate readonly context: GitServiceContext,\n\t\tprivate readonly git: Git,\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: CliGitProviderInternal,\n\t) {}\n\n\t@debug({ quiet: true })\n\tasync getTag(repoPath: string, name: string, cancellation?: AbortSignal): Promise<GitTag | undefined> {\n\t\tconst {\n\t\t\tvalues: [tag],\n\t\t} = await this.getTags(repoPath, { filter: t => t.name === name }, cancellation);\n\t\treturn tag;\n\t}\n\n\t@debug({ quiet: true, args: repoPath => ({ repoPath: repoPath }) })\n\tasync getTags(\n\t\trepoPath: string,\n\t\toptions?: {\n\t\t\tfilter?: (t: GitTag) => boolean;\n\t\t\tpaging?: PagingOptions;\n\t\t\tsort?: boolean | TagSortOptions;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PagedResult<GitTag>> {\n\t\tif (!repoPath) return emptyPagedResult;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tlet tagsResult = await this.cache.getTags(\n\t\t\trepoPath,\n\t\t\tasync (commonPath, _cacheable, signal) => {\n\t\t\t\t// Prefer the aggregate signal from the cache; fall back to the caller's cancellation.\n\t\t\t\tsignal ??= cancellation;\n\t\t\t\ttry {\n\t\t\t\t\tconst records = await this.provider.refs.getRefs(commonPath, signal);\n\t\t\t\t\tif (!records.length) return emptyPagedResult;\n\n\t\t\t\t\tusing sw = maybeStopWatch(scope, { log: { onlyExit: true, level: 'debug' } });\n\n\t\t\t\t\tconst tags: GitTag[] = [];\n\n\t\t\t\t\tfor (const record of records) {\n\t\t\t\t\t\tconst fullName = record.name;\n\t\t\t\t\t\tif (!fullName.startsWith('refs/tags/')) continue;\n\n\t\t\t\t\t\t// Annotated tags: peeledObjectname is the commit SHA; objectname is the tag-object SHA.\n\t\t\t\t\t\t// Lightweight tags: peeledObjectname is empty; objectname is already the commit SHA.\n\t\t\t\t\t\tconst annotated = Boolean(record.peeledObjectname);\n\t\t\t\t\t\tconst sha = record.peeledObjectname || record.objectname;\n\n\t\t\t\t\t\ttags.push(\n\t\t\t\t\t\t\tnew GitTag(\n\t\t\t\t\t\t\t\tcommonPath,\n\t\t\t\t\t\t\t\tfullName,\n\t\t\t\t\t\t\t\tsha,\n\t\t\t\t\t\t\t\trecord.subject,\n\t\t\t\t\t\t\t\trecord.creatorDate ? new Date(record.creatorDate) : undefined,\n\t\t\t\t\t\t\t\trecord.authorDate ? new Date(record.authorDate) : undefined,\n\t\t\t\t\t\t\t\tannotated,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tsw?.stop({ suffix: ` parsed ${String(tags.length)} tags` });\n\n\t\t\t\t\treturn { values: tags };\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tscope?.error(ex);\n\t\t\t\t\tif (isCancellationError(ex)) throw ex;\n\n\t\t\t\t\treturn emptyPagedResult;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\n\t\tif (options?.filter != null) {\n\t\t\ttagsResult = {\n\t\t\t\t...tagsResult,\n\t\t\t\tvalues: tagsResult.values.filter(options.filter),\n\t\t\t};\n\t\t}\n\n\t\tif (options?.sort) {\n\t\t\tsortTags(tagsResult.values, typeof options.sort === 'boolean' ? undefined : options.sort);\n\t\t}\n\n\t\treturn tagsResult;\n\t}\n\n\t@debug({ quiet: true })\n\tasync getTagsWithCommit(\n\t\trepoPath: string,\n\t\tsha: string,\n\t\toptions?: { commitDate?: Date; mode?: 'contains' | 'pointsAt' },\n\t\tcancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tconst result = await this.tagsContainingCore(repoPath, sha, options, cancellation);\n\t\tif (!result.stdout) return [];\n\n\t\treturn filterMap(result.stdout.split('\\n'), b => b.trim() || undefined);\n\t}\n\n\tprivate async tagsContainingCore(\n\t\trepoPath: string,\n\t\tsha: string,\n\t\toptions?: { mode?: 'contains' | 'pointsAt' },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitResult> {\n\t\tconst params: string[] = ['tag', '--format=%(refname:short)'];\n\t\tparams.push(options?.mode === 'pointsAt' ? `--points-at=${sha}` : `--contains=${sha}`);\n\n\t\treturn this.git.run(\n\t\t\t{\n\t\t\t\tcwd: repoPath,\n\t\t\t\tcancellation: cancellation,\n\t\t\t\tconfigs: gitConfigsBranch,\n\t\t\t\terrors: 'ignore',\n\t\t\t},\n\t\t\t...params,\n\t\t);\n\t}\n\n\t@debug()\n\tasync createTag(repoPath: string, name: string, sha: string, message?: string): Promise<void> {\n\t\tconst args = ['tag', name, sha];\n\t\tif (message != null && message.length > 0) {\n\t\t\targs.push('-m', message);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.git.run({ cwd: repoPath }, ...args);\n\t\t} catch (ex) {\n\t\t\tthrow getGitCommandError(\n\t\t\t\t'tag',\n\t\t\t\tex as GitError,\n\t\t\t\treason =>\n\t\t\t\t\tnew TagError(\n\t\t\t\t\t\t{ reason: reason, action: 'create', tag: name, gitCommand: { repoPath: repoPath, args: args } },\n\t\t\t\t\t\tex as GitError,\n\t\t\t\t\t),\n\t\t\t);\n\t\t} finally {\n\t\t\tthis.context.hooks?.cache?.onReset?.(repoPath, 'tags');\n\t\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['tags']);\n\t\t}\n\t}\n\n\t@debug()\n\tasync deleteTag(repoPath: string, name: string): Promise<void> {\n\t\tconst args = ['tag', '-d', name];\n\n\t\ttry {\n\t\t\tawait this.git.run({ cwd: repoPath }, ...args);\n\t\t} catch (ex) {\n\t\t\tthrow getGitCommandError(\n\t\t\t\t'tag',\n\t\t\t\tex as GitError,\n\t\t\t\treason =>\n\t\t\t\t\tnew TagError(\n\t\t\t\t\t\t{ reason: reason, action: 'delete', tag: name, gitCommand: { repoPath: repoPath, args: args } },\n\t\t\t\t\t\tex as GitError,\n\t\t\t\t\t),\n\t\t\t);\n\t\t} finally {\n\t\t\tthis.context.hooks?.cache?.onReset?.(repoPath, 'tags');\n\t\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['tags']);\n\t\t}\n\t}\n\n\t@debug()\n\tasync pushTag(\n\t\trepoPath: string,\n\t\tname: string | string[],\n\t\tremote: string,\n\t\toptions?: { force?: boolean },\n\t): Promise<void> {\n\t\tconst names = ensureArray(name);\n\t\tconst args = ['push'];\n\t\tif (options?.force) {\n\t\t\targs.push('--force');\n\t\t}\n\n\t\targs.push(remote, ...names.map(n => `refs/tags/${n}`));\n\n\t\ttry {\n\t\t\tawait this.git.run({ cwd: repoPath }, ...args);\n\t\t} catch (ex) {\n\t\t\tthrow getGitCommandError(\n\t\t\t\t'tag',\n\t\t\t\tex as GitError,\n\t\t\t\treason =>\n\t\t\t\t\tnew TagError(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treason: reason,\n\t\t\t\t\t\t\taction: 'push',\n\t\t\t\t\t\t\ttag: names.join(', '),\n\t\t\t\t\t\t\tgitCommand: { repoPath: repoPath, args: args },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tex as GitError,\n\t\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,IAAa,qBAAb,MAA8D;CAE3C;CACA;CACA;CACA;CAJlB,YACC,SACA,KACA,OACA,UACC;EAJgB,KAAA,UAAA;EACA,KAAA,MAAA;EACA,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,MACM,OAAO,UAAkB,MAAc,cAAyD;EACrG,MAAM,EACL,QAAQ,CAAC,SACN,MAAM,KAAK,QAAQ,UAAU,EAAE,SAAQ,MAAK,EAAE,SAAS,KAAK,GAAG,YAAY;EAC/E,OAAO;CACR;CAEA,MACM,QACL,UACA,SAKA,cAC+B;EAC/B,IAAI,CAAC,UAAU,OAAO;EAEtB,MAAM,QAAQ,gBAAgB;EAE9B,IAAI,aAAa,MAAM,KAAK,MAAM,QACjC,UACA,OAAO,YAAY,YAAY,WAAW;GAEzC,WAAW;GACX,IAAI;;;KACH,MAAM,UAAU,MAAM,KAAK,SAAS,KAAK,QAAQ,YAAY,MAAM;KACnE,IAAI,CAAC,QAAQ,QAAQ,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Z,KAAK,KAAK,SAAS;EAGpB,KAAK,KAAK,QAAQ,GAAG,MAAM,KAAI,MAAK,aAAa,GAAG,CAAC;EAErD,IAAI;GACH,MAAM,KAAK,IAAI,IAAI,EAAE,KAAK,SAAS,GAAG,GAAG,IAAI;EAC9C,SAAS,IAAI;GACZ,MAAM,mBACL,OACA,KACA,WACC,IAAI,SACH;IACS;IACR,QAAQ;IACR,KAAK,MAAM,KAAK,IAAI;IACpB,YAAY;KAAY;KAAgB;IAAK;GAC9C,GACA,EACD,CACF;EACD;CACD;AACD;AAtME,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,mBAAA,WAAA,UAAA,IAAA;AAQrB,WAAA,CAAA,MAAM;CAAE,OAAO;CAAM,OAAM,cAAa,EAAY,SAAS;AAAG,CAAC,CAAA,GAAA,mBAAA,WAAA,WAAA,IAAA;AA4EjE,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,mBAAA,WAAA,qBAAA,IAAA;AAiCrB,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,aAAA,IAAA;AAyBN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,aAAA,IAAA;AAsBN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,WAAA,IAAA"}
1
+ {"version":3,"file":"tags.js","names":[],"sources":["../../../../git-cli/src/providers/tags.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport { TagError } from '@gitlens/git/errors.js';\nimport { GitTag } from '@gitlens/git/models/tag.js';\nimport type { GitTagsSubProvider } from '@gitlens/git/providers/tags.js';\nimport type { TagSortOptions } from '@gitlens/git/utils/sorting.js';\nimport { sortTags } from '@gitlens/git/utils/sorting.js';\nimport { ensureArray, filterMap } from '@gitlens/utils/array.js';\nimport { isCancellationError } from '@gitlens/utils/cancellation.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { ScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport type { PagedResult, PagingOptions } from '@gitlens/utils/paging.js';\nimport { emptyPagedResult } from '@gitlens/utils/paging.js';\nimport type { CacheController } from '@gitlens/utils/promiseCache.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport type { CliGitProviderInternal } from '../cliGitProvider.js';\nimport type { GitResult } from '../exec/exec.types.js';\nimport type { Git, GitError } from '../exec/git.js';\nimport { getGitCommandError, gitConfigsBranch } from '../exec/git.js';\n\nexport class TagsGitSubProvider implements GitTagsSubProvider {\n\tconstructor(\n\t\tprivate readonly context: GitServiceContext,\n\t\tprivate readonly git: Git,\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: CliGitProviderInternal,\n\t) {}\n\n\t@debug({ quiet: true })\n\tasync getTag(repoPath: string, name: string, cancellation?: AbortSignal): Promise<GitTag | undefined> {\n\t\tif (!repoPath) return undefined;\n\n\t\tconst { values } = await this.getSharedTags(repoPath, cancellation);\n\t\treturn values.find(t => t.name === name)?.withRepoPath(repoPath);\n\t}\n\n\t/**\n\t * Whether `getTags(repoPath)` holds a tag `matches` accepts (any when omitted), judged on each as that list would\n\t * hold it, without keeping that worktree's copy of the list\n\t */\n\tasync hasTag(\n\t\trepoPath: string,\n\t\tmatches: ((tag: GitTag) => boolean) | undefined,\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tif (!repoPath) return false;\n\n\t\tconst { values } = await this.getSharedTags(repoPath, cancellation);\n\t\treturn matches == null ? values.length !== 0 : values.some(t => matches(t.withRepoPath(repoPath)));\n\t}\n\n\t@debug({ quiet: true, args: repoPath => ({ repoPath: repoPath }) })\n\tasync getTags(\n\t\trepoPath: string,\n\t\toptions?: {\n\t\t\tfilter?: (t: GitTag) => boolean;\n\t\t\tpaging?: PagingOptions;\n\t\t\tsort?: boolean | TagSortOptions;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PagedResult<GitTag>> {\n\t\tif (!repoPath) return emptyPagedResult;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tlet tagsResult = await this.cache.getTags(\n\t\t\trepoPath,\n\t\t\t(commonPath, cacheable, signal) => this.readTags(commonPath, cacheable, signal ?? cancellation, scope),\n\t\t\tcancellation,\n\t\t);\n\n\t\tif (options?.filter != null) {\n\t\t\ttagsResult = {\n\t\t\t\t...tagsResult,\n\t\t\t\tvalues: tagsResult.values.filter(options.filter),\n\t\t\t};\n\t\t}\n\n\t\tif (options?.sort) {\n\t\t\tsortTags(tagsResult.values, typeof options.sort === 'boolean' ? undefined : options.sort);\n\t\t}\n\n\t\treturn tagsResult;\n\t}\n\n\t/** The tags every worktree of `repoPath` shares, listed from the common path, read once whoever asks */\n\tprivate getSharedTags(repoPath: string, cancellation?: AbortSignal): Promise<PagedResult<GitTag>> {\n\t\tconst scope = getScopedLogger();\n\n\t\treturn this.cache.getSharedTags(\n\t\t\trepoPath,\n\t\t\t(commonPath, cacheable, signal) => this.readTags(commonPath, cacheable, signal ?? cancellation, scope),\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprivate async readTags(\n\t\tcommonPath: string,\n\t\tcacheable: CacheController,\n\t\tsignal: AbortSignal | undefined,\n\t\tscope: ScopedLogger | undefined,\n\t): Promise<PagedResult<GitTag>> {\n\t\ttry {\n\t\t\tconst records = await this.provider.refs.getRefs(commonPath, signal);\n\t\t\tif (!records.length) {\n\t\t\t\t// Empty also means the listing failed; the listing's own cached answer covers a\n\t\t\t\t// repository that truly has no refs without another git run\n\t\t\t\tcacheable.invalidate();\n\t\t\t\treturn emptyPagedResult;\n\t\t\t}\n\n\t\t\tusing sw = maybeStopWatch(scope, { log: { onlyExit: true, level: 'debug' } });\n\n\t\t\tconst tags: GitTag[] = [];\n\n\t\t\tfor (const record of records) {\n\t\t\t\tconst fullName = record.name;\n\t\t\t\tif (!fullName.startsWith('refs/tags/')) continue;\n\n\t\t\t\t// Annotated tags: peeledObjectname is the commit SHA; objectname is the tag-object SHA.\n\t\t\t\t// Lightweight tags: peeledObjectname is empty; objectname is already the commit SHA.\n\t\t\t\tconst annotated = Boolean(record.peeledObjectname);\n\t\t\t\tconst sha = record.peeledObjectname || record.objectname;\n\n\t\t\t\ttags.push(\n\t\t\t\t\tnew GitTag(\n\t\t\t\t\t\tcommonPath,\n\t\t\t\t\t\tfullName,\n\t\t\t\t\t\tsha,\n\t\t\t\t\t\trecord.subject,\n\t\t\t\t\t\trecord.creatorDate ? new Date(record.creatorDate) : undefined,\n\t\t\t\t\t\trecord.authorDate ? new Date(record.authorDate) : undefined,\n\t\t\t\t\t\tannotated,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tsw?.stop({ suffix: ` parsed ${String(tags.length)} tags` });\n\n\t\t\treturn { values: tags };\n\t\t} catch (ex) {\n\t\t\tcacheable.invalidate();\n\t\t\tscope?.error(ex);\n\t\t\tif (isCancellationError(ex)) throw ex;\n\n\t\t\treturn emptyPagedResult;\n\t\t}\n\t}\n\n\t@debug({ quiet: true })\n\tasync getTagsWithCommit(\n\t\trepoPath: string,\n\t\tsha: string,\n\t\toptions?: { commitDate?: Date; mode?: 'contains' | 'pointsAt' },\n\t\tcancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tconst result = await this.tagsContainingCore(repoPath, sha, options, cancellation);\n\t\tif (!result.stdout) return [];\n\n\t\treturn filterMap(result.stdout.split('\\n'), b => b.trim() || undefined);\n\t}\n\n\tprivate async tagsContainingCore(\n\t\trepoPath: string,\n\t\tsha: string,\n\t\toptions?: { mode?: 'contains' | 'pointsAt' },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitResult> {\n\t\tconst params: string[] = ['tag', '--format=%(refname:short)'];\n\t\tparams.push(options?.mode === 'pointsAt' ? `--points-at=${sha}` : `--contains=${sha}`);\n\n\t\treturn this.git.run(\n\t\t\t{\n\t\t\t\tcwd: repoPath,\n\t\t\t\tcancellation: cancellation,\n\t\t\t\tconfigs: gitConfigsBranch,\n\t\t\t\terrors: 'ignore',\n\t\t\t},\n\t\t\t...params,\n\t\t);\n\t}\n\n\t@debug()\n\tasync createTag(repoPath: string, name: string, sha: string, message?: string): Promise<void> {\n\t\tconst args = ['tag', name, sha];\n\t\tif (message != null && message.length > 0) {\n\t\t\targs.push('-m', message);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.git.run({ cwd: repoPath }, ...args);\n\t\t} catch (ex) {\n\t\t\tthrow getGitCommandError(\n\t\t\t\t'tag',\n\t\t\t\tex as GitError,\n\t\t\t\treason =>\n\t\t\t\t\tnew TagError(\n\t\t\t\t\t\t{ reason: reason, action: 'create', tag: name, gitCommand: { repoPath: repoPath, args: args } },\n\t\t\t\t\t\tex as GitError,\n\t\t\t\t\t),\n\t\t\t);\n\t\t} finally {\n\t\t\tthis.context.hooks?.cache?.onReset?.(repoPath, 'tags');\n\t\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['tags']);\n\t\t}\n\t}\n\n\t@debug()\n\tasync deleteTag(repoPath: string, name: string): Promise<void> {\n\t\tconst args = ['tag', '-d', name];\n\n\t\ttry {\n\t\t\tawait this.git.run({ cwd: repoPath }, ...args);\n\t\t} catch (ex) {\n\t\t\tthrow getGitCommandError(\n\t\t\t\t'tag',\n\t\t\t\tex as GitError,\n\t\t\t\treason =>\n\t\t\t\t\tnew TagError(\n\t\t\t\t\t\t{ reason: reason, action: 'delete', tag: name, gitCommand: { repoPath: repoPath, args: args } },\n\t\t\t\t\t\tex as GitError,\n\t\t\t\t\t),\n\t\t\t);\n\t\t} finally {\n\t\t\tthis.context.hooks?.cache?.onReset?.(repoPath, 'tags');\n\t\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['tags']);\n\t\t}\n\t}\n\n\t@debug()\n\tasync pushTag(\n\t\trepoPath: string,\n\t\tname: string | string[],\n\t\tremote: string,\n\t\toptions?: { force?: boolean },\n\t): Promise<void> {\n\t\tconst names = ensureArray(name);\n\t\tconst args = ['push'];\n\t\tif (options?.force) {\n\t\t\targs.push('--force');\n\t\t}\n\n\t\targs.push(remote, ...names.map(n => `refs/tags/${n}`));\n\n\t\ttry {\n\t\t\tawait this.git.run({ cwd: repoPath }, ...args);\n\t\t} catch (ex) {\n\t\t\tthrow getGitCommandError(\n\t\t\t\t'tag',\n\t\t\t\tex as GitError,\n\t\t\t\treason =>\n\t\t\t\t\tnew TagError(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treason: reason,\n\t\t\t\t\t\t\taction: 'push',\n\t\t\t\t\t\t\ttag: names.join(', '),\n\t\t\t\t\t\t\tgitCommand: { repoPath: repoPath, args: args },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tex as GitError,\n\t\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAa,qBAAb,MAA8D;CAE3C;CACA;CACA;CACA;CAJlB,YACC,SACA,KACA,OACA,UACC;EAJgB,KAAA,UAAA;EACA,KAAA,MAAA;EACA,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,MACM,OAAO,UAAkB,MAAc,cAAyD;EACrG,IAAI,CAAC,UAAU,OAAO,KAAA;EAEtB,MAAM,EAAE,WAAW,MAAM,KAAK,cAAc,UAAU,YAAY;EAClE,OAAO,OAAO,MAAK,MAAK,EAAE,SAAS,IAAI,CAAC,EAAE,aAAa,QAAQ;CAChE;;;;;CAMA,MAAM,OACL,UACA,SACA,cACmB;EACnB,IAAI,CAAC,UAAU,OAAO;EAEtB,MAAM,EAAE,WAAW,MAAM,KAAK,cAAc,UAAU,YAAY;EAClE,OAAO,WAAW,OAAO,OAAO,WAAW,IAAI,OAAO,MAAK,MAAK,QAAQ,EAAE,aAAa,QAAQ,CAAC,CAAC;CAClG;CAEA,MACM,QACL,UACA,SAKA,cAC+B;EAC/B,IAAI,CAAC,UAAU,OAAO;EAEtB,MAAM,QAAQ,gBAAgB;EAE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AsBN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,WAAA,IAAA"}
@@ -85,6 +85,21 @@ export interface CliGitServiceOptions {
85
85
  *
86
86
  * git.dispose(); // cleans up provider, cache, and module-level state
87
87
  * ```
88
+ *
89
+ * The cache shares a repository's data between its checkouts only once each checkout is registered
90
+ * (`cache.registerRepoPath`). A host that registers checkouts in the background can have each one registered before
91
+ * its first read through `forRepo` by setting a registrar once it has the service (see
92
+ * `Cache.setRepoPathRegistrar`; `undefined` declines a path):
93
+ *
94
+ * ```typescript
95
+ * cache.setRepoPathRegistrar(path =>
96
+ * isKnownCheckout(path)
97
+ * ? git.forRepo(path)!.config.getGitDir!().then(gitDir => {
98
+ * if (gitDir != null) cache.registerRepoPath(fileUri(path), gitDir);
99
+ * })
100
+ * : undefined,
101
+ * );
102
+ * ```
88
103
  */
89
104
  export declare function createCliGitService(options: CliGitServiceOptions): GitService;
90
105
  //#endregion
@@ -24,6 +24,21 @@ import { env } from "node:process";
24
24
  *
25
25
  * git.dispose(); // cleans up provider, cache, and module-level state
26
26
  * ```
27
+ *
28
+ * The cache shares a repository's data between its checkouts only once each checkout is registered
29
+ * (`cache.registerRepoPath`). A host that registers checkouts in the background can have each one registered before
30
+ * its first read through `forRepo` by setting a registrar once it has the service (see
31
+ * `Cache.setRepoPathRegistrar`; `undefined` declines a path):
32
+ *
33
+ * ```typescript
34
+ * cache.setRepoPathRegistrar(path =>
35
+ * isKnownCheckout(path)
36
+ * ? git.forRepo(path)!.config.getGitDir!().then(gitDir => {
37
+ * if (gitDir != null) cache.registerRepoPath(fileUri(path), gitDir);
38
+ * })
39
+ * : undefined,
40
+ * );
41
+ * ```
27
42
  */
28
43
  function createCliGitService(options) {
29
44
  const service = GitService.createSingleton(options.watchingProvider, {
@@ -82,7 +97,10 @@ function createCliGitService(options) {
82
97
  service.watchService?.onDidChangeWorkingTree((repoPath) => provider.cache.onWorkingTreeChanged(repoPath));
83
98
  service.watchService?.onDidChangeRepository((e) => {
84
99
  const changes = e.getUnannouncedChanges();
85
- if (changes.length) provider.cache.onRepositoryChanged(e.repoPath, changes, { movedWorktrees: e.movedWorktrees });
100
+ if (changes.length) provider.cache.onRepositoryChanged(e.repoPath, changes, {
101
+ movedWorktrees: e.movedWorktrees,
102
+ observedAt: e.observedAt
103
+ });
86
104
  });
87
105
  service.watchService?.onDidChangeFetchHead((repoPath) => provider.cache.onRepositoryChanged(repoPath, ["lastFetched"]));
88
106
  return service;
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","names":[],"sources":["../../../git-cli/src/service.ts"],"sourcesContent":["import { env } from 'node:process';\nimport { GitService } from '@gitlens/git/service.js';\nimport type { FileWatchingProvider } from '@gitlens/git/watching/provider.js';\nimport { UnwatchedCacheValidator } from '@gitlens/git/watching/unwatchedCacheValidator.js';\nimport { isNotFound } from '@gitlens/git/watching/watchGroup.js';\nimport type { WatchPollingOptions } from '@gitlens/git/watching/watchService.js';\nimport type { WorktreeSummaryServiceOptions } from '@gitlens/git/watching/worktreeSummary.js';\nimport { fileUri } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderOptions } from './cliGitProvider.js';\nimport { CliGitProvider } from './cliGitProvider.js';\nimport type { GitLocation } from './exec/locator.js';\nimport { findGitPath } from './exec/locator.js';\n\n/**\n * Options for {@link createCliGitService}.\n */\nexport interface CliGitServiceOptions {\n\t/**\n\t * Path(s) to the git binary.\n\t * Auto-detected if omitted (searches PATH, platform-specific locations).\n\t * Ignored when {@link locator} is provided.\n\t */\n\tgitPath?: string | string[];\n\n\t/**\n\t * Custom git binary resolver. When provided, used instead of the\n\t * default `findGitPath(gitPath)` lookup.\n\t */\n\tlocator?: () => Promise<GitLocation>;\n\n\t/** Host-provided context hooks (cache events, workspace, integrations, telemetry, fs) */\n\tcontext: CliGitProviderOptions['context'];\n\n\t/**\n\t * Git execution options passed through to the underlying Git executor. `gitOptions.isTrusted(repoPath)` is the\n\t * per-repository trust gate: a `false` answer rejects git runs in that path with `WorkspaceUntrustedError` before\n\t * any process starts. It applies only when `context.workspace.isTrusted` is unset; that flag wins when present.\n\t */\n\tgitOptions?: CliGitProviderOptions['gitOptions'];\n\n\t/** Use an existing Cache instance, or one will be created */\n\tcache?: CliGitProviderOptions['cache'];\n\n\t/** Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist */\n\tignoredWorktreeFolders?: CliGitProviderOptions['ignoredWorktreeFolders'];\n\n\t/** Refreshes a checkout's index after core's own writes rewrote it (see `CliGitProviderOptions`); off by default */\n\trefreshIndexAfterWrites?: CliGitProviderOptions['refreshIndexAfterWrites'];\n\n\t/**\n\t * Filesystem watching provider. When provided, the {@link GitService}\n\t * will watch repositories for changes (file creates, edits, deletes).\n\t */\n\twatchingProvider?: FileWatchingProvider;\n\n\t/**\n\t * Polls in place of (or beside) the watchers {@link watchingProvider} reports it can't trust. When omitted, no\n\t * watcher is asked.\n\t */\n\twatchPolling?: WatchPollingOptions;\n\n\t/**\n\t * Keeps the caches that never expire (branches, current branch, refs, tags, remotes, worktrees, stashes, gk config,\n\t * paused operation, and what derives from them) fresh for repositories whose `.git` directory nothing watches:\n\t * before such a read, stats the files a watcher would have reported, and lists the ref directories and worktree\n\t * admin entries, applying what moved as a watcher event would. Files git writes by rename are read only once the\n\t * directory they're in moved, so a read of an idle repository costs a stat per git dir, per ref directory, per\n\t * linked worktree and per file git writes in place, at most once per 250ms per repository; a watched one costs\n\t * nothing, unless its watch is suspended, which holds what it hears until it resumes. Never runs git: a repository\n\t * whose git dir nothing resolved yet is read from its own files, and one whose files can't show it (bare, a\n\t * submodule, `--separate-git-dir`, `core.worktree`) isn't validated until a read resolves it, its files looked at\n\t * again every 30 seconds. What moves in a worktree under an {@link ignoredWorktreeFolders} folder clears nothing. Without a\n\t * {@link watchingProvider}, every repository counts as unwatched. A read waits at most `timeoutMs` (default 1000)\n\t * for the stats, then is served from the cache, and the stats run one at a time per repository and two at once\n\t * overall. A stat on a hung mount holds one of Node's file-system threads until it returns; one outstanding past\n\t * `timeoutMs` lets other repositories' stats go on, as long as the stats hold all but two of the threads\n\t * (`UV_THREADPOOL_SIZE`, default 4), which leaves the host two. Off by default.\n\t */\n\tvalidateUnwatchedCaches?: boolean | { readonly timeoutMs?: number };\n\n\t/** For tests only; production never passes it (see `WorktreeSummaryServiceOptions.verifyBaseRemeasure`) */\n\tverifyBaseRemeasure?: WorktreeSummaryServiceOptions['verifyBaseRemeasure'];\n}\n\n/**\n * Creates a ready-to-use {@link GitService} backed by the CLI git provider.\n *\n * This is the primary entry point for standalone (non-VS Code) consumers\n * of the `@gitlens/git-cli` library. It creates a singleton {@link GitService},\n * wires up a {@link CliGitProvider}, and registers it for all repository paths.\n *\n * @example\n * ```typescript\n * const git = createCliGitService({ context: {} });\n *\n * const repo = git.forRepo('/path/to/repo')!;\n * const branches = await repo.branches.getBranches();\n * const status = await repo.status.getStatus();\n * await repo.ops!.fetch({ remote: 'origin' });\n *\n * git.dispose(); // cleans up provider, cache, and module-level state\n * ```\n */\nexport function createCliGitService(options: CliGitServiceOptions): GitService {\n\tconst service = GitService.createSingleton(options.watchingProvider, {\n\t\twatchPolling: options.watchPolling,\n\t\tverifyBaseRemeasure: options.verifyBaseRemeasure,\n\t\t// The host's file system reads the shared `.git/config` the watch service compares reports of\n\t\treadFile: path => options.context.fs.readFile(fileUri(path)),\n\t\t// And lists the directory the admin entries of its worktrees are in\n\t\treadDirectory: path => options.context.fs.readDirectory(fileUri(path)),\n\t});\n\n\tconst locator = options.locator ?? (() => findGitPath(options.gitPath ?? null));\n\tconst provider = new CliGitProvider({\n\t\tcontext: options.context,\n\t\tlocator: locator,\n\t\tgitOptions: options.gitOptions,\n\t\tcache: options.cache,\n\t\tignoredWorktreeFolders: options.ignoredWorktreeFolders,\n\t\trefreshIndexAfterWrites: options.refreshIndexAfterWrites,\n\t});\n\n\tservice.register(provider, () => true);\n\n\tif (options.validateUnwatchedCaches) {\n\t\tconst fs = options.context.fs;\n\t\tconst validator = new UnwatchedCacheValidator({\n\t\t\tcache: provider.cache,\n\t\t\ttimeoutMs:\n\t\t\t\ttypeof options.validateUnwatchedCaches === 'object'\n\t\t\t\t\t? options.validateUnwatchedCaches.timeoutMs\n\t\t\t\t\t: undefined,\n\t\t\tmaxFsThreads: getThreadPoolSize() - 2,\n\t\t\tstat: async path => {\n\t\t\t\ttry {\n\t\t\t\t\tconst stat = await fs.stat(fileUri(path));\n\t\t\t\t\treturn stat != null ? { mtime: stat.mtime, size: stat.size } : undefined;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (isNotFound(ex)) return undefined;\n\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\treadDirectory: path => fs.readDirectory(fileUri(path)),\n\t\t\treadFile: async path => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await fs.readFile(fileUri(path));\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (isNotFound(ex)) return undefined;\n\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Only for a path whose git dir is cached, which it finds the common git dir from without running git\n\t\t\tgetIgnoredWorktreeRoots: repoPath =>\n\t\t\t\tprovider.cache.gitDir.get(repoPath) != null\n\t\t\t\t\t? provider.getIgnoredWorktreeRoots(repoPath)\n\t\t\t\t\t: Promise.resolve([]),\n\t\t\tresolveGitDir: repoPath => provider.config.resolveGitDirWithoutGit(repoPath),\n\t\t\t// The watch service keys repositories as the cache does (`getRepositoryKey` normalizes a file path alike)\n\t\t\tisWatched: repoPath => service.watchService?.isRepoWatched(repoPath) ?? false,\n\t\t});\n\t\tprovider.cache.setReadValidator(\n\t\t\trepoPath => validator.validate(repoPath),\n\t\t\t() => validator.getResourceUsage(),\n\t\t);\n\t\tservice.watchService?.onDidChangeRepoWatched(e => {\n\t\t\tif (e.watched) {\n\t\t\t\tvalidator.onWatched(e.repoPath);\n\t\t\t} else {\n\t\t\t\tvalidator.onUnwatched(e.repoPath);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Advance the provider cache's status generation clock from the watch session's global events — the standalone\n\t// analogue of what the VS Code host wires in `GitProviderService`. Without this, a consumer that passes a\n\t// `watchingProvider` and drives watch sessions gets FS events but a FROZEN clock, so `dedupeByStatusGeneration`\n\t// degrades to the pre-change/post-change stale-join this branch exists to fix. Standalone has no `Repository`\n\t// models, so there are no force-fired `closed`/`lastFetched` bypassing the session for the global repo event to\n\t// miss. Subscriptions are torn down with the service (its `watchService`'s emitters are disposed on dispose).\n\tservice.watchService?.onDidChangeWorkingTree(repoPath => provider.cache.onWorkingTreeChanged(repoPath));\n\t// Announced kinds were evicted when core announced its write; evicting them again would discard what the host\n\t// re-read since\n\tservice.watchService?.onDidChangeRepository(e => {\n\t\tconst changes = e.getUnannouncedChanges();\n\t\tif (changes.length) {\n\t\t\tprovider.cache.onRepositoryChanged(e.repoPath, changes, { movedWorktrees: e.movedWorktrees });\n\t\t}\n\t});\n\t// FETCH_HEAD maps to no session change, and there's no `Repository` model here to force-fire `lastFetched` (as\n\t// the VS Code host does), so bridge it straight to the cache or the last-fetched time is never re-read.\n\tservice.watchService?.onDidChangeFetchHead(repoPath =>\n\t\tprovider.cache.onRepositoryChanged(repoPath, ['lastFetched']),\n\t);\n\treturn service;\n}\n\n/** The size of libuv's thread pool, which runs Node's file-system calls, as libuv reads it at its first use */\nfunction getThreadPoolSize(): number {\n\tconst size = Number.parseInt(env.UV_THREADPOOL_SIZE ?? '', 10);\n\treturn Number.isNaN(size) ? 4 : Math.min(Math.max(size, 1), 1024);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA,SAAgB,oBAAoB,SAA2C;CAC9E,MAAM,UAAU,WAAW,gBAAgB,QAAQ,kBAAkB;EACpE,cAAc,QAAQ;EACtB,qBAAqB,QAAQ;EAE7B,WAAU,SAAQ,QAAQ,QAAQ,GAAG,SAAS,QAAQ,IAAI,CAAC;EAE3D,gBAAe,SAAQ,QAAQ,QAAQ,GAAG,cAAc,QAAQ,IAAI,CAAC;CACtE,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AQ,cAAc,wBAAuB,MAAK;GACjD,IAAI,EAAE,SACL,UAAU,UAAU,EAAE,QAAQ;QAE9B,UAAU,YAAY,EAAE,QAAQ;EAElC,CAAC;CACF;CAQA,QAAQ,cAAc,wBAAuB,aAAY,SAAS,MAAM,qBAAqB,QAAQ,CAAC;CAGtG,QAAQ,cAAc,uBAAsB,MAAK;EAChD,MAAM,UAAU,EAAE,sBAAsB;EACxC,IAAI,QAAQ,QACX,SAAS,MAAM,oBAAoB,EAAE,UAAU,SAAS,EAAE,gBAAgB,EAAE,eAAe,CAAC;CAE9F,CAAC;CAGD,QAAQ,cAAc,sBAAqB,aAC1C,SAAS,MAAM,oBAAoB,UAAU,CAAC,aAAa,CAAC,CAC7D;CACA,OAAO;AACR;;AAGA,SAAS,oBAA4B;CACpC,MAAM,OAAO,OAAO,SAAS,IAAI,sBAAsB,IAAI,EAAE;CAC7D,OAAO,OAAO,MAAM,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,GAAG,IAAI;AACjE"}
1
+ {"version":3,"file":"service.js","names":[],"sources":["../../../git-cli/src/service.ts"],"sourcesContent":["import { env } from 'node:process';\nimport { GitService } from '@gitlens/git/service.js';\nimport type { FileWatchingProvider } from '@gitlens/git/watching/provider.js';\nimport { UnwatchedCacheValidator } from '@gitlens/git/watching/unwatchedCacheValidator.js';\nimport { isNotFound } from '@gitlens/git/watching/watchGroup.js';\nimport type { WatchPollingOptions } from '@gitlens/git/watching/watchService.js';\nimport type { WorktreeSummaryServiceOptions } from '@gitlens/git/watching/worktreeSummary.js';\nimport { fileUri } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderOptions } from './cliGitProvider.js';\nimport { CliGitProvider } from './cliGitProvider.js';\nimport type { GitLocation } from './exec/locator.js';\nimport { findGitPath } from './exec/locator.js';\n\n/**\n * Options for {@link createCliGitService}.\n */\nexport interface CliGitServiceOptions {\n\t/**\n\t * Path(s) to the git binary.\n\t * Auto-detected if omitted (searches PATH, platform-specific locations).\n\t * Ignored when {@link locator} is provided.\n\t */\n\tgitPath?: string | string[];\n\n\t/**\n\t * Custom git binary resolver. When provided, used instead of the\n\t * default `findGitPath(gitPath)` lookup.\n\t */\n\tlocator?: () => Promise<GitLocation>;\n\n\t/** Host-provided context hooks (cache events, workspace, integrations, telemetry, fs) */\n\tcontext: CliGitProviderOptions['context'];\n\n\t/**\n\t * Git execution options passed through to the underlying Git executor. `gitOptions.isTrusted(repoPath)` is the\n\t * per-repository trust gate: a `false` answer rejects git runs in that path with `WorkspaceUntrustedError` before\n\t * any process starts. It applies only when `context.workspace.isTrusted` is unset; that flag wins when present.\n\t */\n\tgitOptions?: CliGitProviderOptions['gitOptions'];\n\n\t/** Use an existing Cache instance, or one will be created */\n\tcache?: CliGitProviderOptions['cache'];\n\n\t/** Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist */\n\tignoredWorktreeFolders?: CliGitProviderOptions['ignoredWorktreeFolders'];\n\n\t/** Refreshes a checkout's index after core's own writes rewrote it (see `CliGitProviderOptions`); off by default */\n\trefreshIndexAfterWrites?: CliGitProviderOptions['refreshIndexAfterWrites'];\n\n\t/**\n\t * Filesystem watching provider. When provided, the {@link GitService}\n\t * will watch repositories for changes (file creates, edits, deletes).\n\t */\n\twatchingProvider?: FileWatchingProvider;\n\n\t/**\n\t * Polls in place of (or beside) the watchers {@link watchingProvider} reports it can't trust. When omitted, no\n\t * watcher is asked.\n\t */\n\twatchPolling?: WatchPollingOptions;\n\n\t/**\n\t * Keeps the caches that never expire (branches, current branch, refs, tags, remotes, worktrees, stashes, gk config,\n\t * paused operation, and what derives from them) fresh for repositories whose `.git` directory nothing watches:\n\t * before such a read, stats the files a watcher would have reported, and lists the ref directories and worktree\n\t * admin entries, applying what moved as a watcher event would. Files git writes by rename are read only once the\n\t * directory they're in moved, so a read of an idle repository costs a stat per git dir, per ref directory, per\n\t * linked worktree and per file git writes in place, at most once per 250ms per repository; a watched one costs\n\t * nothing, unless its watch is suspended, which holds what it hears until it resumes. Never runs git: a repository\n\t * whose git dir nothing resolved yet is read from its own files, and one whose files can't show it (bare, a\n\t * submodule, `--separate-git-dir`, `core.worktree`) isn't validated until a read resolves it, its files looked at\n\t * again every 30 seconds. What moves in a worktree under an {@link ignoredWorktreeFolders} folder clears nothing. Without a\n\t * {@link watchingProvider}, every repository counts as unwatched. A read waits at most `timeoutMs` (default 1000)\n\t * for the stats, then is served from the cache, and the stats run one at a time per repository and two at once\n\t * overall. A stat on a hung mount holds one of Node's file-system threads until it returns; one outstanding past\n\t * `timeoutMs` lets other repositories' stats go on, as long as the stats hold all but two of the threads\n\t * (`UV_THREADPOOL_SIZE`, default 4), which leaves the host two. Off by default.\n\t */\n\tvalidateUnwatchedCaches?: boolean | { readonly timeoutMs?: number };\n\n\t/** For tests only; production never passes it (see `WorktreeSummaryServiceOptions.verifyBaseRemeasure`) */\n\tverifyBaseRemeasure?: WorktreeSummaryServiceOptions['verifyBaseRemeasure'];\n}\n\n/**\n * Creates a ready-to-use {@link GitService} backed by the CLI git provider.\n *\n * This is the primary entry point for standalone (non-VS Code) consumers\n * of the `@gitlens/git-cli` library. It creates a singleton {@link GitService},\n * wires up a {@link CliGitProvider}, and registers it for all repository paths.\n *\n * @example\n * ```typescript\n * const git = createCliGitService({ context: {} });\n *\n * const repo = git.forRepo('/path/to/repo')!;\n * const branches = await repo.branches.getBranches();\n * const status = await repo.status.getStatus();\n * await repo.ops!.fetch({ remote: 'origin' });\n *\n * git.dispose(); // cleans up provider, cache, and module-level state\n * ```\n *\n * The cache shares a repository's data between its checkouts only once each checkout is registered\n * (`cache.registerRepoPath`). A host that registers checkouts in the background can have each one registered before\n * its first read through `forRepo` by setting a registrar once it has the service (see\n * `Cache.setRepoPathRegistrar`; `undefined` declines a path):\n *\n * ```typescript\n * cache.setRepoPathRegistrar(path =>\n * \tisKnownCheckout(path)\n * \t\t? git.forRepo(path)!.config.getGitDir!().then(gitDir => {\n * \t\t\t\tif (gitDir != null) cache.registerRepoPath(fileUri(path), gitDir);\n * \t\t\t})\n * \t\t: undefined,\n * );\n * ```\n */\nexport function createCliGitService(options: CliGitServiceOptions): GitService {\n\tconst service = GitService.createSingleton(options.watchingProvider, {\n\t\twatchPolling: options.watchPolling,\n\t\tverifyBaseRemeasure: options.verifyBaseRemeasure,\n\t\t// The host's file system reads the shared `.git/config` the watch service compares reports of\n\t\treadFile: path => options.context.fs.readFile(fileUri(path)),\n\t\t// And lists the directory the admin entries of its worktrees are in\n\t\treadDirectory: path => options.context.fs.readDirectory(fileUri(path)),\n\t});\n\n\tconst locator = options.locator ?? (() => findGitPath(options.gitPath ?? null));\n\tconst provider = new CliGitProvider({\n\t\tcontext: options.context,\n\t\tlocator: locator,\n\t\tgitOptions: options.gitOptions,\n\t\tcache: options.cache,\n\t\tignoredWorktreeFolders: options.ignoredWorktreeFolders,\n\t\trefreshIndexAfterWrites: options.refreshIndexAfterWrites,\n\t});\n\n\tservice.register(provider, () => true);\n\n\tif (options.validateUnwatchedCaches) {\n\t\tconst fs = options.context.fs;\n\t\tconst validator = new UnwatchedCacheValidator({\n\t\t\tcache: provider.cache,\n\t\t\ttimeoutMs:\n\t\t\t\ttypeof options.validateUnwatchedCaches === 'object'\n\t\t\t\t\t? options.validateUnwatchedCaches.timeoutMs\n\t\t\t\t\t: undefined,\n\t\t\tmaxFsThreads: getThreadPoolSize() - 2,\n\t\t\tstat: async path => {\n\t\t\t\ttry {\n\t\t\t\t\tconst stat = await fs.stat(fileUri(path));\n\t\t\t\t\treturn stat != null ? { mtime: stat.mtime, size: stat.size } : undefined;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (isNotFound(ex)) return undefined;\n\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\treadDirectory: path => fs.readDirectory(fileUri(path)),\n\t\t\treadFile: async path => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await fs.readFile(fileUri(path));\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (isNotFound(ex)) return undefined;\n\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Only for a path whose git dir is cached, which it finds the common git dir from without running git\n\t\t\tgetIgnoredWorktreeRoots: repoPath =>\n\t\t\t\tprovider.cache.gitDir.get(repoPath) != null\n\t\t\t\t\t? provider.getIgnoredWorktreeRoots(repoPath)\n\t\t\t\t\t: Promise.resolve([]),\n\t\t\tresolveGitDir: repoPath => provider.config.resolveGitDirWithoutGit(repoPath),\n\t\t\t// The watch service keys repositories as the cache does (`getRepositoryKey` normalizes a file path alike)\n\t\t\tisWatched: repoPath => service.watchService?.isRepoWatched(repoPath) ?? false,\n\t\t});\n\t\tprovider.cache.setReadValidator(\n\t\t\trepoPath => validator.validate(repoPath),\n\t\t\t() => validator.getResourceUsage(),\n\t\t);\n\t\tservice.watchService?.onDidChangeRepoWatched(e => {\n\t\t\tif (e.watched) {\n\t\t\t\tvalidator.onWatched(e.repoPath);\n\t\t\t} else {\n\t\t\t\tvalidator.onUnwatched(e.repoPath);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Advance the provider cache's status generation clock from the watch session's global events — the standalone\n\t// analogue of what the VS Code host wires in `GitProviderService`. Without this, a consumer that passes a\n\t// `watchingProvider` and drives watch sessions gets FS events but a FROZEN clock, so `dedupeByStatusGeneration`\n\t// degrades to the pre-change/post-change stale-join this branch exists to fix. Standalone has no `Repository`\n\t// models, so there are no force-fired `closed`/`lastFetched` bypassing the session for the global repo event to\n\t// miss. Subscriptions are torn down with the service (its `watchService`'s emitters are disposed on dispose).\n\tservice.watchService?.onDidChangeWorkingTree(repoPath => provider.cache.onWorkingTreeChanged(repoPath));\n\t// Announced kinds were evicted when core announced its write; evicting them again would discard what the host\n\t// re-read since\n\tservice.watchService?.onDidChangeRepository(e => {\n\t\tconst changes = e.getUnannouncedChanges();\n\t\tif (changes.length) {\n\t\t\tprovider.cache.onRepositoryChanged(e.repoPath, changes, {\n\t\t\t\tmovedWorktrees: e.movedWorktrees,\n\t\t\t\tobservedAt: e.observedAt,\n\t\t\t});\n\t\t}\n\t});\n\t// FETCH_HEAD maps to no session change, and there's no `Repository` model here to force-fire `lastFetched` (as\n\t// the VS Code host does), so bridge it straight to the cache or the last-fetched time is never re-read.\n\tservice.watchService?.onDidChangeFetchHead(repoPath =>\n\t\tprovider.cache.onRepositoryChanged(repoPath, ['lastFetched']),\n\t);\n\treturn service;\n}\n\n/** The size of libuv's thread pool, which runs Node's file-system calls, as libuv reads it at its first use */\nfunction getThreadPoolSize(): number {\n\tconst size = Number.parseInt(env.UV_THREADPOOL_SIZE ?? '', 10);\n\treturn Number.isNaN(size) ? 4 : Math.min(Math.max(size, 1), 1024);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHA,SAAgB,oBAAoB,SAA2C;CAC9E,MAAM,UAAU,WAAW,gBAAgB,QAAQ,kBAAkB;EACpE,cAAc,QAAQ;EACtB,qBAAqB,QAAQ;EAE7B,WAAU,SAAQ,QAAQ,QAAQ,GAAG,SAAS,QAAQ,IAAI,CAAC;EAE3D,gBAAe,SAAQ,QAAQ,QAAQ,GAAG,cAAc,QAAQ,IAAI,CAAC;CACtE,CAAC;CAED,MAAM,UAAU,QAAQ,kBAAkB,YAAY,QAAQ,WAAW,IAAI;CAC7E,MAAM,WAAW,IAAI,eAAe;EACnC,SAAS,QAAQ;EACR;EACT,YAAY,QAAQ;EACpB,OAAO,QAAQ;EACf,wBAAwB,QAAQ;EAChC,yBAAyB,QAAQ;CAClC,CAAC;CAED,QAAQ,SAAS,gBAAgB,IAAI;CAErC,IAAI,QAAQ,yBAAyB;EACpC,MAAM,KAAK,QAAQ,QAAQ;EAC3B,MAAM,YAAY,IAAI,wBAAwB;GAC7C,OAAO,SAAS;GAChB,WACC,OAAO,QAAQ,4BAA4B,WACxC,QAAQ,wBAAwB,YAChC,KAAA;GACJ,cAAc,kBAAkB,IAAI;GACpC,MAAM,OAAM,SAAQ;IACnB,IAA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;AAGA,SAAS,oBAA4B;CACpC,MAAM,OAAO,OAAO,SAAS,IAAI,sBAAsB,IAAI,EAAE;CAC7D,OAAO,OAAO,MAAM,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,GAAG,IAAI;AACjE"}
@@ -20,6 +20,7 @@ export declare class DiffGitSubProvider implements GitDiffSubProvider {
20
20
  filters?: GitDiffFilter[];
21
21
  includeUntracked?: boolean;
22
22
  path?: string;
23
+ paths?: string[];
23
24
  renameLimit?: number;
24
25
  similarityThreshold?: number;
25
26
  errors?: GitErrorHandling;
@@ -8,6 +8,7 @@ import { createRevisionRange, getRevisionRangeParts, isRevisionRange, stripOrigi
8
8
  import __decorate from "../../../../_virtual/@oxc-project+runtime/helpers/esm/decorate.js";
9
9
  import { GitFileIndexStatus } from "../../../../git/models/fileStatus.js";
10
10
  import { getChangedFilesCount } from "../../../../git/utils/commit.utils.js";
11
+ import { toLiteralPathspecMatcher } from "../../../../git/utils/fileStatus.utils.js";
11
12
  import { encodeGitLensRevisionUriAuthority } from "../../../../git/utils/uriAuthority.js";
12
13
  import { fromCommitFileStatus } from "../../models.js";
13
14
  import { toTokenInfo } from "../../api/tokenUtils.js";
@@ -56,6 +57,7 @@ var DiffGitSubProvider = class {
56
57
  }
57
58
  async getDiffStatus(repoPath, ref1OrRange, ref2, options) {
58
59
  if (repoPath == null) return void 0;
60
+ if (options?.paths?.length === 0) return void 0;
59
61
  const scope = getScopedLogger();
60
62
  const { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);
61
63
  let range;
@@ -81,7 +83,7 @@ var DiffGitSubProvider = class {
81
83
  const files2 = getSettledValue(result2)?.files;
82
84
  files = [...new Set(union(files1, files2))];
83
85
  } else files = (await github.getComparison(token, metadata.repo.owner, metadata.repo.name, stripOrigin(range)))?.files;
84
- return files?.map((f) => ({
86
+ const mapped = files?.map((f) => ({
85
87
  path: f.filename ?? "",
86
88
  originalPath: f.previous_filename,
87
89
  status: fromCommitFileStatus(f.status) ?? GitFileIndexStatus.Modified,
@@ -92,6 +94,9 @@ var DiffGitSubProvider = class {
92
94
  changes: f.changes
93
95
  }
94
96
  }));
97
+ if (mapped == null || options?.paths == null) return mapped;
98
+ const matches = toLiteralPathspecMatcher(options.paths);
99
+ return mapped.filter((f) => matches(f.path) || f.originalPath != null && matches(f.originalPath));
95
100
  } catch (ex) {
96
101
  scope?.error(ex);
97
102
  debugger;
@@ -1 +1 @@
1
- {"version":3,"file":"diff.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/diff.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitDiffFilter, GitDiffShortStat } from '@gitlens/git/models/diff.js';\nimport type { GitFile } from '@gitlens/git/models/file.js';\nimport { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { GitRevisionRange } from '@gitlens/git/models/revision.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type {\n\tGitDiffSubProvider,\n\tNextComparisonUrisResult,\n\tPreviousComparisonUrisResult,\n\tPreviousRangeComparisonUrisResult,\n} from '@gitlens/git/providers/diff.js';\nimport type { DiffRange, RevisionUri } from '@gitlens/git/providers/types.js';\nimport type { GitErrorHandling } from '@gitlens/git/run.types.js';\nimport { getChangedFilesCount } from '@gitlens/git/utils/commit.utils.js';\nimport {\n\tcreateRevisionRange,\n\tgetRevisionRangeParts,\n\tisRevisionRange,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { encodeGitLensRevisionUriAuthority } from '@gitlens/git/utils/uriAuthority.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { union } from '@gitlens/utils/iterable.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { getSettledValue } from '@gitlens/utils/promise.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { fromUri } from '@gitlens/utils/uri.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport { fromCommitFileStatus } from '../../models.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nconst slash = 47;\n\nfunction createRevisionUri(repoPath: string, relativePath: string, sha: string | undefined): RevisionUri {\n\t// For virtual repos, the path is the relative path prefixed with /\n\tlet uriPath = relativePath.replace(/\\\\/g, '/');\n\tif (uriPath.charCodeAt(0) !== slash) {\n\t\turiPath = `/${uriPath}`;\n\t}\n\treturn {\n\t\turi: fromUri({\n\t\t\tscheme: 'gitlens',\n\t\t\tauthority: encodeGitLensRevisionUriAuthority({ ref: sha, repoPath: repoPath }),\n\t\t\tpath: uriPath,\n\t\t}),\n\t\tpath: relativePath,\n\t\tsha: sha,\n\t\trepoPath: repoPath,\n\t};\n}\n\nexport class DiffGitSubProvider implements GitDiffSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tasync getChangedFilesCount(\n\t\trepoPath: string,\n\t\tto?: string,\n\t\tfrom?: string,\n\t\t_options?: { uris?: (string | Uri)[]; includeUntracked?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitDiffShortStat | undefined> {\n\t\t// Virtual GitHub repos have no working tree, so no working changes can exist.\n\t\t// Without any refs, return empty stats rather than undefined to avoid \"uncertain state\" callers.\n\t\tif (!to && !from) return { additions: 0, deletions: 0, files: 0 };\n\n\t\t// If only `from` is provided, compare against HEAD\n\t\tif (!to) {\n\t\t\tto = 'HEAD';\n\t\t}\n\n\t\tconst commit = await this.provider.commits.getCommit(repoPath, to);\n\t\tif (commit?.stats == null) return undefined;\n\n\t\tconst { stats } = commit;\n\n\t\tconst changedFiles = getChangedFilesCount(stats.files);\n\t\treturn { additions: stats.additions, deletions: stats.deletions, files: changedFiles };\n\t}\n\n\t@debug()\n\tasync getDiffStatus(\n\t\trepoPath: string,\n\t\tref1OrRange: string | GitRevisionRange,\n\t\tref2?: string,\n\t\toptions?: {\n\t\t\tfilters?: GitDiffFilter[];\n\t\t\tincludeUntracked?: boolean;\n\t\t\tpath?: string;\n\t\t\trenameLimit?: number;\n\t\t\tsimilarityThreshold?: number;\n\t\t\terrors?: GitErrorHandling;\n\t\t},\n\t): Promise<GitFile[] | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\tlet range: GitRevisionRange;\n\t\tif (isRevisionRange(ref1OrRange)) {\n\t\t\trange = ref1OrRange;\n\n\t\t\tif (!isRevisionRange(ref1OrRange, 'qualified')) {\n\t\t\t\tconst parts = getRevisionRangeParts(ref1OrRange);\n\t\t\t\trange = createRevisionRange(parts?.left || 'HEAD', parts?.right || 'HEAD', parts?.notation ?? '...');\n\t\t\t}\n\t\t} else {\n\t\t\trange = createRevisionRange(ref1OrRange || 'HEAD', ref2 || 'HEAD', '...');\n\t\t}\n\n\t\tlet range2: GitRevisionRange | undefined;\n\t\t// GitHub doesn't support the `..` range notation, so we will need to do some extra work\n\t\tif (isRevisionRange(range, 'qualified-double-dot')) {\n\t\t\tconst parts = getRevisionRangeParts(range)!;\n\n\t\t\trange = createRevisionRange(parts.left, parts.right, '...');\n\t\t\trange2 = createRevisionRange(parts.right, parts.left, '...');\n\t\t}\n\n\t\ttry {\n\t\t\tconst token = toTokenInfo(this.provider.authenticationProviderId, session);\n\n\t\t\tlet files;\n\t\t\tif (range2) {\n\t\t\t\t// GitHub doesn't support `..`, so issue both `...` comparisons in parallel and union the results.\n\t\t\t\tconst [result1, result2] = await Promise.allSettled([\n\t\t\t\t\tgithub.getComparison(token, metadata.repo.owner, metadata.repo.name, stripOrigin(range)),\n\t\t\t\t\tgithub.getComparison(token, metadata.repo.owner, metadata.repo.name, stripOrigin(range2)),\n\t\t\t\t]);\n\n\t\t\t\tconst files1 = getSettledValue(result1)?.files;\n\t\t\t\tconst files2 = getSettledValue(result2)?.files;\n\n\t\t\t\tfiles = [...new Set(union(files1, files2))];\n\t\t\t} else {\n\t\t\t\tconst result = await github.getComparison(\n\t\t\t\t\ttoken,\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(range),\n\t\t\t\t);\n\t\t\t\tfiles = result?.files;\n\t\t\t}\n\n\t\t\treturn files?.map(f => ({\n\t\t\t\tpath: f.filename ?? '',\n\t\t\t\toriginalPath: f.previous_filename,\n\t\t\t\tstatus: fromCommitFileStatus(f.status) ?? GitFileIndexStatus.Modified,\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tstats: { additions: f.additions, deletions: f.deletions, changes: f.changes },\n\t\t\t}));\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\tif (options?.errors === 'throw') throw ex;\n\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@debug()\n\tasync getNextComparisonUris(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\trev: string | undefined,\n\t\tskip: number = 0,\n\t\t_options?: { ordering?: 'date' | 'author-date' | 'topo' | null },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<NextComparisonUrisResult | undefined> {\n\t\t// If we have no revision there is no next commit\n\t\tif (!rev) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst path = this.provider.getRelativePath(pathOrUri, repoPath);\n\n\t\ttry {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return undefined;\n\n\t\t\tconst { metadata, github, session } = context;\n\t\t\tconst revision = (await metadata.getRevision()).revision;\n\n\t\t\tif (rev === 'HEAD') {\n\t\t\t\trev = revision;\n\t\t\t}\n\n\t\t\tconst refs = await github.getNextCommitRefs(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tmetadata.repo.owner,\n\t\t\t\tmetadata.repo.name,\n\t\t\t\trevision,\n\t\t\t\tpath,\n\t\t\t\tstripOrigin(rev),\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcurrent:\n\t\t\t\t\tskip === 0\n\t\t\t\t\t\t? createRevisionUri(repoPath, path, rev)\n\t\t\t\t\t\t: createRevisionUri(repoPath, path, refs[skip - 1]),\n\t\t\t\tnext: refs[skip] != null ? createRevisionUri(repoPath, path, refs[skip]) : undefined,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@debug()\n\tasync getPreviousComparisonUris(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\trev: string | undefined,\n\t\tskip: number = 0,\n\t\t_unsaved?: boolean,\n\t\t_options?: { ordering?: 'date' | 'author-date' | 'topo' | null },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<PreviousComparisonUrisResult | undefined> {\n\t\tif (rev === deletedOrMissing) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst path = this.provider.getRelativePath(pathOrUri, repoPath);\n\n\t\ttry {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return undefined;\n\n\t\t\tconst { metadata, github, session } = context;\n\n\t\t\tconst offset = rev != null ? 1 : 0;\n\n\t\t\tconst result = await github.getCommitRefs(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tmetadata.repo.owner,\n\t\t\t\tmetadata.repo.name,\n\t\t\t\tstripOrigin(!rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev),\n\t\t\t\t{\n\t\t\t\t\tpath: path,\n\t\t\t\t\tfirst: offset + skip + 1,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\n\t\t\t// If we are at a commit, diff commit with previous\n\t\t\tconst currentSha = skip === 0 ? rev : (result.values[offset + skip - 1]?.oid ?? deletedOrMissing);\n\n\t\t\tif (currentSha === deletedOrMissing) return undefined;\n\n\t\t\treturn {\n\t\t\t\tcurrent: createRevisionUri(repoPath, path, currentSha),\n\t\t\t\tprevious: createRevisionUri(repoPath, path, result.values[offset + skip]?.oid ?? deletedOrMissing),\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@debug()\n\t// oxlint-disable-next-line typescript/require-await\n\tasync getPreviousComparisonUrisForRange(\n\t\t_repoPath: string,\n\t\t_path: string | Uri,\n\t\t_rev: string | undefined,\n\t\t_range: DiffRange,\n\t\t_options?: { ordering?: 'date' | 'author-date' | 'topo' | null; skipFirstRev?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<PreviousRangeComparisonUrisResult | undefined> {\n\t\t// This method requires `getBlameForLine` which depends on VS Code-specific\n\t\t// blame infrastructure. It will be overridden in the extension wrapper.\n\t\treturn undefined;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,QAAQ;AAEd,SAAS,kBAAkB,UAAkB,cAAsB,KAAsC;CAExG,IAAI,UAAU,aAAa,QAAQ,OAAO,GAAG;CAC7C,IAAI,QAAQ,WAAW,CAAC,MAAM,OAC7B,UAAU,IAAI;CAEf,OAAO;EACN,KAAK,QAAQ;GACZ,QAAQ;GACR,WAAW,kCAAkC;IAAE,KAAK;IAAe;GAAS,CAAC;GAC7E,MAAM;EACP,CAAC;EACD,MAAM;EACD;EACK;CACX;AACD;AAEA,IAAa,qBAAb,MAA8D;CAE3C;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,MACM,qBACL,UACA,IACA,MACA,UACA,eACwC;EAGxC,IAAI,CAAC,MAAM,CAAC,MAAM,OAAO;GAAE,WAAW;GAAG,WAAW;GAAG,OAAO;EAAE;EAGhE,IAAI,CAAC,IACJ,KAAK;EAGN,MAAM,SAAS,MAAM,KAAK,SAAS,QAAQ,UAAU,UAAU,EAAE;EACjE,IAAI,QAAQ,SAAS,MAAM,OAAO,KAAA;EA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A,6BAAA,IAAA;AAqDN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,qCAAA,IAAA"}
1
+ {"version":3,"file":"diff.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/diff.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitDiffFilter, GitDiffShortStat } from '@gitlens/git/models/diff.js';\nimport type { GitFile } from '@gitlens/git/models/file.js';\nimport { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { GitRevisionRange } from '@gitlens/git/models/revision.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type {\n\tGitDiffSubProvider,\n\tNextComparisonUrisResult,\n\tPreviousComparisonUrisResult,\n\tPreviousRangeComparisonUrisResult,\n} from '@gitlens/git/providers/diff.js';\nimport type { DiffRange, RevisionUri } from '@gitlens/git/providers/types.js';\nimport type { GitErrorHandling } from '@gitlens/git/run.types.js';\nimport { getChangedFilesCount } from '@gitlens/git/utils/commit.utils.js';\nimport { toLiteralPathspecMatcher } from '@gitlens/git/utils/fileStatus.utils.js';\nimport {\n\tcreateRevisionRange,\n\tgetRevisionRangeParts,\n\tisRevisionRange,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { encodeGitLensRevisionUriAuthority } from '@gitlens/git/utils/uriAuthority.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { union } from '@gitlens/utils/iterable.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { getSettledValue } from '@gitlens/utils/promise.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { fromUri } from '@gitlens/utils/uri.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport { fromCommitFileStatus } from '../../models.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nconst slash = 47;\n\nfunction createRevisionUri(repoPath: string, relativePath: string, sha: string | undefined): RevisionUri {\n\t// For virtual repos, the path is the relative path prefixed with /\n\tlet uriPath = relativePath.replace(/\\\\/g, '/');\n\tif (uriPath.charCodeAt(0) !== slash) {\n\t\turiPath = `/${uriPath}`;\n\t}\n\treturn {\n\t\turi: fromUri({\n\t\t\tscheme: 'gitlens',\n\t\t\tauthority: encodeGitLensRevisionUriAuthority({ ref: sha, repoPath: repoPath }),\n\t\t\tpath: uriPath,\n\t\t}),\n\t\tpath: relativePath,\n\t\tsha: sha,\n\t\trepoPath: repoPath,\n\t};\n}\n\nexport class DiffGitSubProvider implements GitDiffSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tasync getChangedFilesCount(\n\t\trepoPath: string,\n\t\tto?: string,\n\t\tfrom?: string,\n\t\t_options?: { uris?: (string | Uri)[]; includeUntracked?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitDiffShortStat | undefined> {\n\t\t// Virtual GitHub repos have no working tree, so no working changes can exist.\n\t\t// Without any refs, return empty stats rather than undefined to avoid \"uncertain state\" callers.\n\t\tif (!to && !from) return { additions: 0, deletions: 0, files: 0 };\n\n\t\t// If only `from` is provided, compare against HEAD\n\t\tif (!to) {\n\t\t\tto = 'HEAD';\n\t\t}\n\n\t\tconst commit = await this.provider.commits.getCommit(repoPath, to);\n\t\tif (commit?.stats == null) return undefined;\n\n\t\tconst { stats } = commit;\n\n\t\tconst changedFiles = getChangedFilesCount(stats.files);\n\t\treturn { additions: stats.additions, deletions: stats.deletions, files: changedFiles };\n\t}\n\n\t@debug()\n\tasync getDiffStatus(\n\t\trepoPath: string,\n\t\tref1OrRange: string | GitRevisionRange,\n\t\tref2?: string,\n\t\toptions?: {\n\t\t\tfilters?: GitDiffFilter[];\n\t\t\tincludeUntracked?: boolean;\n\t\t\tpath?: string;\n\t\t\tpaths?: string[];\n\t\t\trenameLimit?: number;\n\t\t\tsimilarityThreshold?: number;\n\t\t\terrors?: GitErrorHandling;\n\t\t},\n\t): Promise<GitFile[] | undefined> {\n\t\tif (repoPath == null) return undefined;\n\t\tif (options?.paths?.length === 0) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\tlet range: GitRevisionRange;\n\t\tif (isRevisionRange(ref1OrRange)) {\n\t\t\trange = ref1OrRange;\n\n\t\t\tif (!isRevisionRange(ref1OrRange, 'qualified')) {\n\t\t\t\tconst parts = getRevisionRangeParts(ref1OrRange);\n\t\t\t\trange = createRevisionRange(parts?.left || 'HEAD', parts?.right || 'HEAD', parts?.notation ?? '...');\n\t\t\t}\n\t\t} else {\n\t\t\trange = createRevisionRange(ref1OrRange || 'HEAD', ref2 || 'HEAD', '...');\n\t\t}\n\n\t\tlet range2: GitRevisionRange | undefined;\n\t\t// GitHub doesn't support the `..` range notation, so we will need to do some extra work\n\t\tif (isRevisionRange(range, 'qualified-double-dot')) {\n\t\t\tconst parts = getRevisionRangeParts(range)!;\n\n\t\t\trange = createRevisionRange(parts.left, parts.right, '...');\n\t\t\trange2 = createRevisionRange(parts.right, parts.left, '...');\n\t\t}\n\n\t\ttry {\n\t\t\tconst token = toTokenInfo(this.provider.authenticationProviderId, session);\n\n\t\t\tlet files;\n\t\t\tif (range2) {\n\t\t\t\t// GitHub doesn't support `..`, so issue both `...` comparisons in parallel and union the results.\n\t\t\t\tconst [result1, result2] = await Promise.allSettled([\n\t\t\t\t\tgithub.getComparison(token, metadata.repo.owner, metadata.repo.name, stripOrigin(range)),\n\t\t\t\t\tgithub.getComparison(token, metadata.repo.owner, metadata.repo.name, stripOrigin(range2)),\n\t\t\t\t]);\n\n\t\t\t\tconst files1 = getSettledValue(result1)?.files;\n\t\t\t\tconst files2 = getSettledValue(result2)?.files;\n\n\t\t\t\tfiles = [...new Set(union(files1, files2))];\n\t\t\t} else {\n\t\t\t\tconst result = await github.getComparison(\n\t\t\t\t\ttoken,\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(range),\n\t\t\t\t);\n\t\t\t\tfiles = result?.files;\n\t\t\t}\n\n\t\t\tconst mapped = files?.map((f): GitFile => ({\n\t\t\t\tpath: f.filename ?? '',\n\t\t\t\toriginalPath: f.previous_filename,\n\t\t\t\tstatus: fromCommitFileStatus(f.status) ?? GitFileIndexStatus.Modified,\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tstats: { additions: f.additions, deletions: f.deletions, changes: f.changes },\n\t\t\t}));\n\t\t\tif (mapped == null || options?.paths == null) return mapped;\n\n\t\t\t// Either side counts because renames are detected before any path limit, so a rename into or out of the\n\t\t\t// paths is kept whole, where git would split it into an add or a delete\n\t\t\tconst matches = toLiteralPathspecMatcher(options.paths);\n\t\t\treturn mapped.filter(f => matches(f.path) || (f.originalPath != null && matches(f.originalPath)));\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\tif (options?.errors === 'throw') throw ex;\n\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@debug()\n\tasync getNextComparisonUris(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\trev: string | undefined,\n\t\tskip: number = 0,\n\t\t_options?: { ordering?: 'date' | 'author-date' | 'topo' | null },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<NextComparisonUrisResult | undefined> {\n\t\t// If we have no revision there is no next commit\n\t\tif (!rev) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst path = this.provider.getRelativePath(pathOrUri, repoPath);\n\n\t\ttry {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return undefined;\n\n\t\t\tconst { metadata, github, session } = context;\n\t\t\tconst revision = (await metadata.getRevision()).revision;\n\n\t\t\tif (rev === 'HEAD') {\n\t\t\t\trev = revision;\n\t\t\t}\n\n\t\t\tconst refs = await github.getNextCommitRefs(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tmetadata.repo.owner,\n\t\t\t\tmetadata.repo.name,\n\t\t\t\trevision,\n\t\t\t\tpath,\n\t\t\t\tstripOrigin(rev),\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcurrent:\n\t\t\t\t\tskip === 0\n\t\t\t\t\t\t? createRevisionUri(repoPath, path, rev)\n\t\t\t\t\t\t: createRevisionUri(repoPath, path, refs[skip - 1]),\n\t\t\t\tnext: refs[skip] != null ? createRevisionUri(repoPath, path, refs[skip]) : undefined,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@debug()\n\tasync getPreviousComparisonUris(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\trev: string | undefined,\n\t\tskip: number = 0,\n\t\t_unsaved?: boolean,\n\t\t_options?: { ordering?: 'date' | 'author-date' | 'topo' | null },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<PreviousComparisonUrisResult | undefined> {\n\t\tif (rev === deletedOrMissing) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst path = this.provider.getRelativePath(pathOrUri, repoPath);\n\n\t\ttry {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return undefined;\n\n\t\t\tconst { metadata, github, session } = context;\n\n\t\t\tconst offset = rev != null ? 1 : 0;\n\n\t\t\tconst result = await github.getCommitRefs(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tmetadata.repo.owner,\n\t\t\t\tmetadata.repo.name,\n\t\t\t\tstripOrigin(!rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev),\n\t\t\t\t{\n\t\t\t\t\tpath: path,\n\t\t\t\t\tfirst: offset + skip + 1,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\n\t\t\t// If we are at a commit, diff commit with previous\n\t\t\tconst currentSha = skip === 0 ? rev : (result.values[offset + skip - 1]?.oid ?? deletedOrMissing);\n\n\t\t\tif (currentSha === deletedOrMissing) return undefined;\n\n\t\t\treturn {\n\t\t\t\tcurrent: createRevisionUri(repoPath, path, currentSha),\n\t\t\t\tprevious: createRevisionUri(repoPath, path, result.values[offset + skip]?.oid ?? deletedOrMissing),\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@debug()\n\t// oxlint-disable-next-line typescript/require-await\n\tasync getPreviousComparisonUrisForRange(\n\t\t_repoPath: string,\n\t\t_path: string | Uri,\n\t\t_rev: string | undefined,\n\t\t_range: DiffRange,\n\t\t_options?: { ordering?: 'date' | 'author-date' | 'topo' | null; skipFirstRev?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<PreviousRangeComparisonUrisResult | undefined> {\n\t\t// This method requires `getBlameForLine` which depends on VS Code-specific\n\t\t// blame infrastructure. It will be overridden in the extension wrapper.\n\t\treturn undefined;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAM,QAAQ;AAEd,SAAS,kBAAkB,UAAkB,cAAsB,KAAsC;CAExG,IAAI,UAAU,aAAa,QAAQ,OAAO,GAAG;CAC7C,IAAI,QAAQ,WAAW,CAAC,MAAM,OAC7B,UAAU,IAAI;CAEf,OAAO;EACN,KAAK,QAAQ;GACZ,QAAQ;GACR,WAAW,kCAAkC;IAAE,KAAK;IAAe;GAAS,CAAC;GAC7E,MAAM;EACP,CAAC;EACD,MAAM;EACD;EACK;CACX;AACD;AAEA,IAAa,qBAAb,MAA8D;CAE3C;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,MACM,qBACL,UACA,IACA,MACA,UACA,eACwC;EAGxC,IAAI,CAAC,MAAM,CAAC,MAAM,OAAO;GAAE,WAAW;GAAG,WAAW;GAAG,OAAO;EAAE;EAGhE,IAAI,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;GAClG;EACD,SAAS,IAAI;GACZ,OAAO,MAAM,EAAE;GACf;GAEA,MAAM;EACP;CACD;CAEA,MAEM,kCACL,WACA,OACA,MACA,QACA,UACA,eACyD,CAI1D;AACD;AA1OE,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,wBAAA,IAAA;AA0BN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,iBAAA,IAAA;AA0FN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,yBAAA,IAAA;AAmDN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,6BAAA,IAAA;AAqDN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,qCAAA,IAAA"}
@@ -1155,6 +1155,7 @@ function createIntegrationService(ctx) {
1155
1155
  let service;
1156
1156
  service = new IntegrationService(new IntegrationAuthenticationService(configured, ctx, () => service, cloud), configured, ctx);
1157
1157
  purgeRetiredIntegrationStorage(ctx, configured);
1158
+ purgeJiraDiscoveryStorage(ctx);
1158
1159
  return service;
1159
1160
  }
1160
1161
  const retiredIntegrationsStorageKey = "integrations:migrated:cloudOnly";
@@ -1165,6 +1166,14 @@ async function purgeRetiredIntegrationStorage(ctx, configured) {
1165
1166
  await ctx.storage.store(retiredIntegrationsStorageKey, true);
1166
1167
  } catch {}
1167
1168
  }
1169
+ async function purgeJiraDiscoveryStorage(ctx) {
1170
+ const key = "integrations:migrated:jiraDiscovery";
1171
+ if (ctx.storage.get(key)) return;
1172
+ try {
1173
+ await ctx.storage.deleteWithPrefix("jira:");
1174
+ await ctx.storage.store(key, true);
1175
+ } catch {}
1176
+ }
1168
1177
  function protocolFromDomain(domain) {
1169
1178
  const value = domain?.trim();
1170
1179
  if (!value) return void 0;