@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
@@ -1,5 +1,5 @@
1
1
  //#region ../git/src/features.d.ts
2
- export type GitFeatures = 'git:checkout:pathspec-from-file' | 'git:commit-graph' | 'git:commit-graph:changed-paths' | 'git:fetch:all-config' | 'git:fetch:follow-remote-head' | 'git:fetch:no-write-fetch-head' | 'git:for-each-ref:ahead-behind' | 'git:for-each-ref:worktreePath' | 'git:fsmonitor' | 'git:fsmonitor:linux' | 'git:ignoreRevsFile' | 'git:index:skipHash' | 'git:maintenance' | 'git:maintenance:pack-refs' | 'git:maintenance:start' | 'git:maintenance:start:systemd' | 'git:manyFiles' | 'git:merge-tree:trees' | 'git:merge-tree:write-tree' | 'git:patch-id:binary-oids' | 'git:patch-id:verbatim' | 'git:push:force-if-includes' | 'git:rebase:autosquash' | 'git:rev-parse:end-of-options' | 'git:rev-parse:reflog-oldest-old-value' | 'git:signing:ssh' | 'git:signing:x509' | 'git:sparse-index' | 'git:stash:push:pathspecs' | 'git:stash:push:staged' | 'git:stash:push:stdin' | 'git:status:find-renames' | 'git:status:ignored-matching' | 'git:status:porcelain-v2' | 'git:untrackedCache' | 'git:worktree:list:lock-reason' | 'git:worktrees';
2
+ export type GitFeatures = 'git:checkout:pathspec-from-file' | 'git:commit-graph' | 'git:commit-graph:changed-paths' | 'git:diff:autoRefreshIndex:off' | 'git:fetch:all-config' | 'git:fetch:follow-remote-head' | 'git:fetch:no-write-fetch-head' | 'git:for-each-ref:ahead-behind' | 'git:for-each-ref:worktreePath' | 'git:fsmonitor' | 'git:fsmonitor:linux' | 'git:ignoreRevsFile' | 'git:index:skipHash' | 'git:log:diff-merges' | 'git:ls-files:directory' | 'git:maintenance' | 'git:maintenance:pack-refs' | 'git:maintenance:start' | 'git:maintenance:start:systemd' | 'git:manyFiles' | 'git:merge-tree:trees' | 'git:merge-tree:write-tree' | 'git:patch-id:binary-oids' | 'git:patch-id:verbatim' | 'git:push:force-if-includes' | 'git:rebase:autosquash' | 'git:rev-parse:end-of-options' | 'git:rev-parse:reflog-oldest-old-value' | 'git:signing:ssh' | 'git:signing:x509' | 'git:sparse-index' | 'git:stash:push:pathspecs' | 'git:stash:push:staged' | 'git:stash:push:stdin' | 'git:status:find-renames' | 'git:status:ignored-matching' | 'git:status:porcelain-v2' | 'git:untrackedCache' | 'git:worktree:list:lock-reason' | 'git:worktrees';
3
3
  type ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}` ? Rest extends `${infer SubPrefix}:${string}` ? T | `${Prefix}:${SubPrefix}` | Prefix : T | Prefix : never;
4
4
  export type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;
5
5
  export type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures ? T : Extract<GitFeatures, T | `${T}:${string}`>;
@@ -4,6 +4,7 @@ const gitFeaturesByVersion = /* @__PURE__ */ new Map([
4
4
  ["git:checkout:pathspec-from-file", "2.26"],
5
5
  ["git:commit-graph", "2.24"],
6
6
  ["git:commit-graph:changed-paths", "2.31"],
7
+ ["git:diff:autoRefreshIndex:off", "2.46"],
7
8
  ["git:fetch:all-config", "2.44"],
8
9
  ["git:fetch:follow-remote-head", "2.48"],
9
10
  ["git:fetch:no-write-fetch-head", "2.29"],
@@ -13,6 +14,8 @@ const gitFeaturesByVersion = /* @__PURE__ */ new Map([
13
14
  ["git:fsmonitor:linux", "2.55"],
14
15
  ["git:ignoreRevsFile", "2.23"],
15
16
  ["git:index:skipHash", "2.40"],
17
+ ["git:log:diff-merges", "2.31"],
18
+ ["git:ls-files:directory", "2.27"],
16
19
  ["git:maintenance", "2.30"],
17
20
  ["git:maintenance:pack-refs", "2.31"],
18
21
  ["git:maintenance:start", "2.31"],
@@ -1 +1 @@
1
- {"version":3,"file":"features.js","names":[],"sources":["../../../git/src/features.ts"],"sourcesContent":["// GitFeature's must start with `git:` to be recognized in all usages\nexport type GitFeatures =\n\t| 'git:checkout:pathspec-from-file'\n\t| 'git:commit-graph'\n\t| 'git:commit-graph:changed-paths'\n\t| 'git:fetch:all-config'\n\t| 'git:fetch:follow-remote-head'\n\t| 'git:fetch:no-write-fetch-head'\n\t| 'git:for-each-ref:ahead-behind'\n\t| 'git:for-each-ref:worktreePath'\n\t| 'git:fsmonitor'\n\t| 'git:fsmonitor:linux'\n\t| 'git:ignoreRevsFile'\n\t| 'git:index:skipHash'\n\t| 'git:maintenance'\n\t| 'git:maintenance:pack-refs'\n\t| 'git:maintenance:start'\n\t| 'git:maintenance:start:systemd'\n\t| 'git:manyFiles'\n\t| 'git:merge-tree:trees'\n\t| 'git:merge-tree:write-tree'\n\t| 'git:patch-id:binary-oids'\n\t| 'git:patch-id:verbatim'\n\t| 'git:push:force-if-includes'\n\t| 'git:rebase:autosquash'\n\t| 'git:rev-parse:end-of-options'\n\t| 'git:rev-parse:reflog-oldest-old-value'\n\t| 'git:signing:ssh'\n\t| 'git:signing:x509'\n\t| 'git:sparse-index'\n\t| 'git:stash:push:pathspecs'\n\t| 'git:stash:push:staged'\n\t| 'git:stash:push:stdin'\n\t| 'git:status:find-renames'\n\t| 'git:status:ignored-matching'\n\t| 'git:status:porcelain-v2'\n\t| 'git:untrackedCache'\n\t| 'git:worktree:list:lock-reason'\n\t| 'git:worktrees';\n\ntype ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}`\n\t? Rest extends `${infer SubPrefix}:${string}`\n\t\t? T | `${Prefix}:${SubPrefix}` | Prefix\n\t\t: T | Prefix\n\t: never;\n\nexport type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;\nexport type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures\n\t? T\n\t: Extract<GitFeatures, T | `${T}:${string}`>;\n\nexport const gitMinimumVersion = '2.7.2';\nexport const gitFeaturesByVersion = new Map<GitFeatures, string>([\n\t['git:checkout:pathspec-from-file', '2.26'],\n\t// 2.24 is when git READS the commit-graph file by default (core.commitGraph on); writing it for\n\t// older gits would be dead weight.\n\t['git:commit-graph', '2.24'],\n\t// Changed-path Bloom filters (`--changed-paths`), the v2 filter format — pre-2.31 shipped Bloom filters\n\t// with real correctness bugs (bad results for merge commits), so 2.31 is the safe floor to write them.\n\t['git:commit-graph:changed-paths', '2.31'],\n\t// A bare `fetch` reads every remote when `fetch.all` is set\n\t['git:fetch:all-config', '2.44'],\n\t// A fetch using a remote's configured refspecs creates its missing `refs/remotes/<remote>/HEAD`\n\t// (`remote.<name>.followRemoteHEAD`, default `create`)\n\t['git:fetch:follow-remote-head', '2.48'],\n\t['git:fetch:no-write-fetch-head', '2.29'],\n\t// `%(ahead-behind:<commit>)` in for-each-ref formats\n\t['git:for-each-ref:ahead-behind', '2.41'],\n\t['git:for-each-ref:worktreePath', '2.23'],\n\t// `core.fsmonitor=true` selects the built-in FSMonitor daemon (accepting a bool rather than only a\n\t// hook path). This 2.37 floor is the Windows + macOS one.\n\t['git:fsmonitor', '2.37'],\n\t// Linux got its own FSMonitor backend (inotify) only in 2.55, hence a separate floor. Note the backend\n\t// places a watch on EVERY directory, so a large repo can exhaust `fs.inotify.max_user_watches` and the\n\t// daemon fails at runtime even on a new enough git — the apply path must still probe, not just gate.\n\t['git:fsmonitor:linux', '2.55'],\n\t['git:ignoreRevsFile', '2.23'],\n\t// `index.skipHash` (skip the trailing index checksum for faster writes); part of `feature.manyFiles`.\n\t['git:index:skipHash', '2.40'],\n\t// `git maintenance run --task=…`. The `maintenance` builtin + `commit-graph`/`gc` tasks are 2.29, but\n\t// the loose-objects + incremental-repack tasks the auto tier uses landed in 2.30 (and `core.multiPackIndex`\n\t// is default-on from 2.30, so no separate midx config write is needed) — 2.30 is the safe floor.\n\t['git:maintenance', '2.30'],\n\t// The pack-refs maintenance task landed one release after the maintenance builtin.\n\t['git:maintenance:pack-refs', '2.31'],\n\t// `git maintenance start` — the subcommands exist from 2.30 (cron only); launchctl (macOS) + schtasks\n\t// (Windows) scheduling arrived in 2.31, so 2.31 is the cross-platform-safe floor.\n\t['git:maintenance:start', '2.31'],\n\t// `git maintenance start` systemd-timer scheduling. On Linux, 2.31–2.33 is cron-only and modern distros\n\t// often ship without cron (scheduling then silently fails); the systemd fallback arrived in 2.34.\n\t['git:maintenance:start:systemd', '2.34'],\n\t// `feature.manyFiles` umbrella (index v4 + untracked cache + skipHash where available).\n\t['git:manyFiles', '2.24'],\n\t// `merge-tree --write-tree --merge-base=<base> <tree> <commit>`: `--merge-base` arrived in 2.40, but plain trees as merge\n\t// inputs only in 2.45 — older git rejects a tree with \"expected commit type\"\n\t['git:merge-tree:trees', '2.45'],\n\t// `merge-tree --write-tree` mode with `-z`/`--name-only`/`--no-messages`; the older trivial mode can't check conflicts\n\t['git:merge-tree:write-tree', '2.38'],\n\t// `patch-id` hashes a binary change through its blob ids; older ones hash the diff's text, so need `--binary` data\n\t['git:patch-id:binary-oids', '2.39'],\n\t// `patch-id --verbatim`: hashes whitespace and file-mode header lines instead of normalizing them away\n\t['git:patch-id:verbatim', '2.39'],\n\t['git:push:force-if-includes', '2.30.0'],\n\t// `--autosquash` WITHOUT `-i` (folding `fixup!`/`squash!` commits into a plain/automatic rebase).\n\t// Interactive rebases support autosquash on every git version GitLens supports, so this floor only\n\t// gates the non-interactive path.\n\t['git:rebase:autosquash', '2.44'],\n\t['git:rev-parse:end-of-options', '2.30'],\n\t// `<ref>@{<n>}` for a reflog of exactly n entries names the value before the oldest one, refusing only a null one\n\t// (the entry that created the ref); older ones refuse it either way\n\t['git:rev-parse:reflog-oldest-old-value', '2.31'],\n\t['git:signing:ssh', '2.34.0'],\n\t['git:signing:x509', '2.19.0'],\n\t// Sparse-index support debuted earlier, but 2.33 shipped a corruption fix and 2.34 broadened command\n\t// support. Use 2.34 as the conservative floor before offering a repository mutation.\n\t['git:sparse-index', '2.34'],\n\t['git:stash:push:pathspecs', '2.13.2'],\n\t['git:stash:push:staged', '2.35.0'],\n\t['git:stash:push:stdin', '2.30.0'],\n\t['git:status:find-renames', '2.18'],\n\t// `status --ignored=matching`: an ignored folder is one entry, without a walk of what is inside it\n\t['git:status:ignored-matching', '2.16'],\n\t['git:status:porcelain-v2', '2.11'],\n\t// `core.untrackedCache=true` (repo-local cache of untracked-file scans — the auto-tier config lever).\n\t['git:untrackedCache', '2.8'],\n\t// `worktree list --porcelain` prints a lock's reason (`locked <reason>`); older ones print a bare `locked`\n\t['git:worktree:list:lock-reason', '2.31'],\n\t['git:worktrees', '2.17.0'],\n]);\n"],"mappings":";AAmDA,MAAa,oBAAoB;AACjC,MAAa,uCAAuB,IAAI,IAAyB;CAChE,CAAC,mCAAmC,MAAM;CAG1C,CAAC,oBAAoB,MAAM;CAG3B,CAAC,kCAAkC,MAAM;CAEzC,CAAC,wBAAwB,MAAM;CAG/B,CAAC,gCAAgC,MAAM;CACvC,CAAC,iCAAiC,MAAM;CAExC,CAAC,iCAAiC,MAAM;CACxC,CAAC,iCAAiC,MAAM;CAGxC,CAAC,iBAAiB,MAAM;CAIxB,CAAC,uBAAuB,MAAM;CAC9B,CAAC,sBAAsB,MAAM;CAE7B,CAAC,sBAAsB,MAAM;CAI7B,CAAC,mBAAmB,MAAM;CAE1B,CAAC,6BAA6B,MAAM;CAGpC,CAAC,yBAAyB,MAAM;CAGhC,CAAC,iCAAiC,MAAM;CAExC,CAAC,iBAAiB,MAAM;CAGxB,CAAC,wBAAwB,MAAM;CAE/B,CAAC,6BAA6B,MAAM;CAEpC,CAAC,4BAA4B,MAAM;CAEnC,CAAC,yBAAyB,MAAM;CAChC,CAAC,8BAA8B,QAAQ;CAIvC,CAAC,yBAAyB,MAAM;CAChC,CAAC,gCAAgC,MAAM;CAGvC,CAAC,yCAAyC,MAAM;CAChD,CAAC,mBAAmB,QAAQ;CAC5B,CAAC,oBAAoB,QAAQ;CAG7B,CAAC,oBAAoB,MAAM;CAC3B,CAAC,4BAA4B,QAAQ;CACrC,CAAC,yBAAyB,QAAQ;CAClC,CAAC,wBAAwB,QAAQ;CACjC,CAAC,2BAA2B,MAAM;CAElC,CAAC,+BAA+B,MAAM;CACtC,CAAC,2BAA2B,MAAM;CAElC,CAAC,sBAAsB,KAAK;CAE5B,CAAC,iCAAiC,MAAM;CACxC,CAAC,iBAAiB,QAAQ;AAC3B,CAAC"}
1
+ {"version":3,"file":"features.js","names":[],"sources":["../../../git/src/features.ts"],"sourcesContent":["// GitFeature's must start with `git:` to be recognized in all usages\nexport type GitFeatures =\n\t| 'git:checkout:pathspec-from-file'\n\t| 'git:commit-graph'\n\t| 'git:commit-graph:changed-paths'\n\t| 'git:diff:autoRefreshIndex:off'\n\t| 'git:fetch:all-config'\n\t| 'git:fetch:follow-remote-head'\n\t| 'git:fetch:no-write-fetch-head'\n\t| 'git:for-each-ref:ahead-behind'\n\t| 'git:for-each-ref:worktreePath'\n\t| 'git:fsmonitor'\n\t| 'git:fsmonitor:linux'\n\t| 'git:ignoreRevsFile'\n\t| 'git:index:skipHash'\n\t| 'git:log:diff-merges'\n\t| 'git:ls-files:directory'\n\t| 'git:maintenance'\n\t| 'git:maintenance:pack-refs'\n\t| 'git:maintenance:start'\n\t| 'git:maintenance:start:systemd'\n\t| 'git:manyFiles'\n\t| 'git:merge-tree:trees'\n\t| 'git:merge-tree:write-tree'\n\t| 'git:patch-id:binary-oids'\n\t| 'git:patch-id:verbatim'\n\t| 'git:push:force-if-includes'\n\t| 'git:rebase:autosquash'\n\t| 'git:rev-parse:end-of-options'\n\t| 'git:rev-parse:reflog-oldest-old-value'\n\t| 'git:signing:ssh'\n\t| 'git:signing:x509'\n\t| 'git:sparse-index'\n\t| 'git:stash:push:pathspecs'\n\t| 'git:stash:push:staged'\n\t| 'git:stash:push:stdin'\n\t| 'git:status:find-renames'\n\t| 'git:status:ignored-matching'\n\t| 'git:status:porcelain-v2'\n\t| 'git:untrackedCache'\n\t| 'git:worktree:list:lock-reason'\n\t| 'git:worktrees';\n\ntype ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}`\n\t? Rest extends `${infer SubPrefix}:${string}`\n\t\t? T | `${Prefix}:${SubPrefix}` | Prefix\n\t\t: T | Prefix\n\t: never;\n\nexport type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;\nexport type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures\n\t? T\n\t: Extract<GitFeatures, T | `${T}:${string}`>;\n\nexport const gitMinimumVersion = '2.7.2';\nexport const gitFeaturesByVersion = new Map<GitFeatures, string>([\n\t['git:checkout:pathspec-from-file', '2.26'],\n\t// 2.24 is when git READS the commit-graph file by default (core.commitGraph on); writing it for\n\t// older gits would be dead weight.\n\t['git:commit-graph', '2.24'],\n\t// Changed-path Bloom filters (`--changed-paths`), the v2 filter format — pre-2.31 shipped Bloom filters\n\t// with real correctness bugs (bad results for merge commits), so 2.31 is the safe floor to write them.\n\t['git:commit-graph:changed-paths', '2.31'],\n\t// From 2.46 `diff --quiet` compares contents, so with auto-refresh off a file whose timestamps moved but whose\n\t// content did not still reads as unchanged; before it, such a file reads as changed.\n\t['git:diff:autoRefreshIndex:off', '2.46'],\n\t// A bare `fetch` reads every remote when `fetch.all` is set\n\t['git:fetch:all-config', '2.44'],\n\t// A fetch using a remote's configured refspecs creates its missing `refs/remotes/<remote>/HEAD`\n\t// (`remote.<name>.followRemoteHEAD`, default `create`)\n\t['git:fetch:follow-remote-head', '2.48'],\n\t['git:fetch:no-write-fetch-head', '2.29'],\n\t// `%(ahead-behind:<commit>)` in for-each-ref formats\n\t['git:for-each-ref:ahead-behind', '2.41'],\n\t['git:for-each-ref:worktreePath', '2.23'],\n\t// `core.fsmonitor=true` selects the built-in FSMonitor daemon (accepting a bool rather than only a\n\t// hook path). This 2.37 floor is the Windows + macOS one.\n\t['git:fsmonitor', '2.37'],\n\t// Linux got its own FSMonitor backend (inotify) only in 2.55, hence a separate floor. Note the backend\n\t// places a watch on EVERY directory, so a large repo can exhaust `fs.inotify.max_user_watches` and the\n\t// daemon fails at runtime even on a new enough git — the apply path must still probe, not just gate.\n\t['git:fsmonitor:linux', '2.55'],\n\t['git:ignoreRevsFile', '2.23'],\n\t// `index.skipHash` (skip the trailing index checksum for faster writes); part of `feature.manyFiles`.\n\t['git:index:skipHash', '2.40'],\n\t// `log --diff-merges=first-parent`: diffs a merge against its first parent only (`-m` diffs against every parent)\n\t['git:log:diff-merges', '2.31'],\n\t// `ls-files --others --directory --no-empty-directory` answers from the directory walk as reworked in 2.27;\n\t// the flags themselves are older\n\t['git:ls-files:directory', '2.27'],\n\t// `git maintenance run --task=…`. The `maintenance` builtin + `commit-graph`/`gc` tasks are 2.29, but\n\t// the loose-objects + incremental-repack tasks the auto tier uses landed in 2.30 (and `core.multiPackIndex`\n\t// is default-on from 2.30, so no separate midx config write is needed) — 2.30 is the safe floor.\n\t['git:maintenance', '2.30'],\n\t// The pack-refs maintenance task landed one release after the maintenance builtin.\n\t['git:maintenance:pack-refs', '2.31'],\n\t// `git maintenance start` — the subcommands exist from 2.30 (cron only); launchctl (macOS) + schtasks\n\t// (Windows) scheduling arrived in 2.31, so 2.31 is the cross-platform-safe floor.\n\t['git:maintenance:start', '2.31'],\n\t// `git maintenance start` systemd-timer scheduling. On Linux, 2.31–2.33 is cron-only and modern distros\n\t// often ship without cron (scheduling then silently fails); the systemd fallback arrived in 2.34.\n\t['git:maintenance:start:systemd', '2.34'],\n\t// `feature.manyFiles` umbrella (index v4 + untracked cache + skipHash where available).\n\t['git:manyFiles', '2.24'],\n\t// `merge-tree --write-tree --merge-base=<base> <tree> <commit>`: `--merge-base` arrived in 2.40, but plain trees as merge\n\t// inputs only in 2.45 — older git rejects a tree with \"expected commit type\"\n\t['git:merge-tree:trees', '2.45'],\n\t// `merge-tree --write-tree` mode with `-z`/`--name-only`/`--no-messages`; the older trivial mode can't check conflicts\n\t['git:merge-tree:write-tree', '2.38'],\n\t// `patch-id` hashes a binary change through its blob ids; older ones hash the diff's text, so need `--binary` data\n\t['git:patch-id:binary-oids', '2.39'],\n\t// `patch-id --verbatim`: hashes whitespace and file-mode header lines instead of normalizing them away\n\t['git:patch-id:verbatim', '2.39'],\n\t['git:push:force-if-includes', '2.30.0'],\n\t// `--autosquash` WITHOUT `-i` (folding `fixup!`/`squash!` commits into a plain/automatic rebase).\n\t// Interactive rebases support autosquash on every git version GitLens supports, so this floor only\n\t// gates the non-interactive path.\n\t['git:rebase:autosquash', '2.44'],\n\t['git:rev-parse:end-of-options', '2.30'],\n\t// `<ref>@{<n>}` for a reflog of exactly n entries names the value before the oldest one, refusing only a null one\n\t// (the entry that created the ref); older ones refuse it either way\n\t['git:rev-parse:reflog-oldest-old-value', '2.31'],\n\t['git:signing:ssh', '2.34.0'],\n\t['git:signing:x509', '2.19.0'],\n\t// Sparse-index support debuted earlier, but 2.33 shipped a corruption fix and 2.34 broadened command\n\t// support. Use 2.34 as the conservative floor before offering a repository mutation.\n\t['git:sparse-index', '2.34'],\n\t['git:stash:push:pathspecs', '2.13.2'],\n\t['git:stash:push:staged', '2.35.0'],\n\t['git:stash:push:stdin', '2.30.0'],\n\t['git:status:find-renames', '2.18'],\n\t// `status --ignored=matching`: an ignored folder is one entry, without a walk of what is inside it\n\t['git:status:ignored-matching', '2.16'],\n\t['git:status:porcelain-v2', '2.11'],\n\t// `core.untrackedCache=true` (repo-local cache of untracked-file scans — the auto-tier config lever).\n\t['git:untrackedCache', '2.8'],\n\t// `worktree list --porcelain` prints a lock's reason (`locked <reason>`); older ones print a bare `locked`\n\t['git:worktree:list:lock-reason', '2.31'],\n\t['git:worktrees', '2.17.0'],\n]);\n"],"mappings":";AAsDA,MAAa,oBAAoB;AACjC,MAAa,uCAAuB,IAAI,IAAyB;CAChE,CAAC,mCAAmC,MAAM;CAG1C,CAAC,oBAAoB,MAAM;CAG3B,CAAC,kCAAkC,MAAM;CAGzC,CAAC,iCAAiC,MAAM;CAExC,CAAC,wBAAwB,MAAM;CAG/B,CAAC,gCAAgC,MAAM;CACvC,CAAC,iCAAiC,MAAM;CAExC,CAAC,iCAAiC,MAAM;CACxC,CAAC,iCAAiC,MAAM;CAGxC,CAAC,iBAAiB,MAAM;CAIxB,CAAC,uBAAuB,MAAM;CAC9B,CAAC,sBAAsB,MAAM;CAE7B,CAAC,sBAAsB,MAAM;CAE7B,CAAC,uBAAuB,MAAM;CAG9B,CAAC,0BAA0B,MAAM;CAIjC,CAAC,mBAAmB,MAAM;CAE1B,CAAC,6BAA6B,MAAM;CAGpC,CAAC,yBAAyB,MAAM;CAGhC,CAAC,iCAAiC,MAAM;CAExC,CAAC,iBAAiB,MAAM;CAGxB,CAAC,wBAAwB,MAAM;CAE/B,CAAC,6BAA6B,MAAM;CAEpC,CAAC,4BAA4B,MAAM;CAEnC,CAAC,yBAAyB,MAAM;CAChC,CAAC,8BAA8B,QAAQ;CAIvC,CAAC,yBAAyB,MAAM;CAChC,CAAC,gCAAgC,MAAM;CAGvC,CAAC,yCAAyC,MAAM;CAChD,CAAC,mBAAmB,QAAQ;CAC5B,CAAC,oBAAoB,QAAQ;CAG7B,CAAC,oBAAoB,MAAM;CAC3B,CAAC,4BAA4B,QAAQ;CACrC,CAAC,yBAAyB,QAAQ;CAClC,CAAC,wBAAwB,QAAQ;CACjC,CAAC,2BAA2B,MAAM;CAElC,CAAC,+BAA+B,MAAM;CACtC,CAAC,2BAA2B,MAAM;CAElC,CAAC,sBAAsB,KAAK;CAE5B,CAAC,iCAAiC,MAAM;CACxC,CAAC,iBAAiB,QAAQ;AAC3B,CAAC"}
@@ -43,6 +43,17 @@ export interface AheadOfBase {
43
43
  readonly dependsOn: readonly string[];
44
44
  /** The default branch the read resolved from local refs and the remotes' `HEAD` symrefs, `null` when none did; absent when it didn't consult the default branch (a recorded candidate decided the base first) */
45
45
  readonly defaultBranch?: string | null;
46
+ /** `true` when a read inside this one failed and a fallback answered in its place (a merge base for a fork point that couldn't be read or settled, a stored value read as absent): the best answer there is, but one a read where every read succeeds may not give, so it is no `previous` for `getAheadOfBaseAfterBaseMove` or `getAheadOfBaseAfterCommit` to keep (nor does `getMergeTarget` cache such an answer). Absent otherwise */
47
+ readonly provisional?: true;
48
+ /**
49
+ * The commit HEAD's side of the answer was measured at: for a named branch the cached ref list gives a tip for and
50
+ * places in the checkout read, that tip, which every count, fork point and merge base in the read was taken from
51
+ * instead of HEAD as git found it. Only when the host wires a read validator (`Cache.setReadValidator`), which
52
+ * keeps that list current. Absent when the read measured from HEAD itself (a detached HEAD, a branch the list
53
+ * doesn't name or place there, git before 2.23, or no read validator) or there is no base. A host may ignore it;
54
+ * `getAheadOfBaseAfterCommit` takes it to know whose count `base.ahead` is.
55
+ */
56
+ readonly measuredFrom?: string;
46
57
  }
47
58
  /** Which source decided a merge target (see `getMergeTarget`): an {@link AheadOfBaseTier}, the pull request's base, or the branch HEAD was on when the branch was created */
48
59
  export type MergeTargetTier = AheadOfBaseTier | 'pr' | 'inferred';
@@ -279,14 +290,44 @@ export interface GitBranchesSubProvider {
279
290
  * history with the base and its reflog, and with that the fork point, the reflog's move off it, the count past it
280
291
  * and the choice of base, stay as they were; only `base.sha` moves, and `defaultBranch` is kept. A fork point the
281
292
  * base was rebased off, still a value of its reflog but off its new tip's history, is settled again as a full read
282
- * does, and must keep the fork point and its count. `undefined` when any of that can't be shown, and a full `getAheadOfBase` is due.
293
+ * does, and must keep the fork point and its count. It also answers when the local default branch tracking a
294
+ * remote-tracking base moved, alone or with the base, if HEAD shares nothing past `previous.base.forkPoint` with
295
+ * that branch's tip or reflog; moved alone, the previous answer comes back unchanged. HEAD doesn't move, so the
296
+ * answer keeps `previous.measuredFrom`. `undefined` when any of that can't be shown, and a full `getAheadOfBase` is
297
+ * due.
283
298
  */
284
299
  getAheadOfBaseAfterBaseMove?(repoPath: string, branch: string | undefined, previous: {
285
300
  readonly head: string;
286
301
  readonly base: NonNullable<AheadOfBase['base']>;
287
302
  readonly dependsOn: readonly string[];
288
303
  readonly defaultBranch?: string | null;
304
+ readonly measuredFrom?: string;
289
305
  }, moved: readonly string[], cancellation?: AbortSignal): Promise<AheadOfBase | undefined>;
306
+ /**
307
+ * Carries `previous`, a `getAheadOfBase` answer for `branch` read with HEAD at `previous.head`, past one ordinary
308
+ * commit: `head`, the branch's tip now, without resolving the base again. It answers `previous` with
309
+ * `base.ahead` one higher only when that provably equals a fresh `getAheadOfBase`: `head`'s only parent is
310
+ * `previous.head`, and no tip or reflog value of the refs in `previous.dependsOn` but the branch's own reaches it, as
311
+ * one git run shows, and `previous.base.ahead` is the count as of `previous.head`: known when
312
+ * `previous.measuredFrom` is `previous.head`, and otherwise shown by a second run. The answer is measured from
313
+ * `head`. Such a commit is one no fork point, merge base or count against those refs takes in but the
314
+ * count of HEAD's own commits, so the choice of base, its fork point and every other field stay as they were. Only
315
+ * while the base's tip is still `previous.base.sha`, the default branch resolves as `previous.defaultBranch` when one
316
+ * did, `previous.base.ahead` is HEAD's commits not on the base (at least one, past a fork point in the base's
317
+ * history other than `previous.head`, and not a preferred target's or an upstream the default branch contains), the
318
+ * branch's reflog says nothing new of where the branch was created from, no ref the read would compare once it
319
+ * exists, and so left out of `previous.dependsOn` while it didn't (the branch it was created from, the `upstream`
320
+ * remote's copy of a candidate), has appeared, and the repository isn't shallow, grafted, holding replace refs, or
321
+ * keeping its reflogs in reftables. `undefined` for a detached HEAD, or when any of that can't be shown, and a full
322
+ * `getAheadOfBase` is due.
323
+ */
324
+ getAheadOfBaseAfterCommit?(repoPath: string, branch: string | undefined, previous: {
325
+ readonly head: string;
326
+ readonly base: NonNullable<AheadOfBase['base']>;
327
+ readonly dependsOn: readonly string[];
328
+ readonly defaultBranch?: string | null;
329
+ readonly measuredFrom?: string;
330
+ }, head: string, cancellation?: AbortSignal): Promise<AheadOfBase | undefined>;
290
331
  /**
291
332
  * How far each branch has diverged from `base`, keyed by full ref name (`refs/heads/x`, plus `refs/remotes/<remote>/x`
292
333
  * when `options.remotes` is set) so a local and a remote name can't collide. Symbolic refs such as
@@ -28,6 +28,13 @@ export interface GitDiffSubProvider {
28
28
  context?: number;
29
29
  index?: DisposableTemporaryGitIndex;
30
30
  notation?: GitRevisionRangeNotation;
31
+ /**
32
+ * `true` detects renames (`-M`, at `similarityThreshold` or the configured one) and `false` turns them
33
+ * off (`--no-renames`), whatever `diff.renames` says; omitted, `diff.renames` decides. `getDiffStatus`
34
+ * always detects them, so pass `true` for the hunks to agree with its list
35
+ */
36
+ renames?: boolean;
37
+ similarityThreshold?: number;
31
38
  uris?: (string | Uri)[];
32
39
  /**
33
40
  * `'throw'` rejects with the failure (a `GitError` carrying git's `stderr` when git ran) rather than
@@ -45,6 +52,9 @@ export interface GitDiffSubProvider {
45
52
  getParsedDiff?(repoPath: string, to: string, from?: string, options?: {
46
53
  context?: number;
47
54
  notation?: GitRevisionRangeNotation;
55
+ /** As on `getDiff` */
56
+ renames?: boolean;
57
+ similarityThreshold?: number;
48
58
  uris?: (string | Uri)[];
49
59
  errors?: GitErrorHandling;
50
60
  }, cancellation?: AbortSignal): Promise<ParsedGitDiff | undefined>;
@@ -53,6 +63,13 @@ export interface GitDiffSubProvider {
53
63
  filters?: GitDiffFilter[];
54
64
  includeUntracked?: boolean;
55
65
  path?: string;
66
+ /**
67
+ * Limits the status to these paths, matched literally (a name with glob characters matches only itself, a
68
+ * folder everything under it). Wins over `path`; an empty list
69
+ * resolves `undefined` without running git. Batched to fit the command line, so a rename whose two sides
70
+ * fall in different batches reads as a delete and an add
71
+ */
72
+ paths?: string[];
56
73
  renameLimit?: number;
57
74
  similarityThreshold?: number;
58
75
  errors?: GitErrorHandling;
@@ -110,6 +110,13 @@ export interface GitProvider {
110
110
  * provider can't tell, because `repoPath` was never registered with it
111
111
  */
112
112
  getCommonPath?(repoPath: string): string | undefined;
113
+ /**
114
+ * Has the host register `repoPath` before it is first read, when the host asked to be (see
115
+ * `Cache.setRepoPathRegistrar`): `undefined` when the read can go ahead at once (nothing to register, already
116
+ * registered, or declined), or a promise, never rejecting, to read after. `GitService`'s per-repository
117
+ * sub-providers ask it before each call, and wait on it for each method that answers only a promise.
118
+ */
119
+ ensureRegistered?(repoPath: string): Promise<void> | undefined;
113
120
  /**
114
121
  * The absolute, normalized folders under `repoPath`'s common git dir whose worktrees core acts as if didn't exist:
115
122
  * they are left out of worktree lists, and their add, remove, lock, unlock or move run through `notify: 'infer'`,
@@ -30,10 +30,14 @@ var RemotesGitProviderBase = class {
30
30
  if (!repoPath) return [];
31
31
  const validation = this.cache.validateBeforeRead(repoPath);
32
32
  if (validation != null) await validation;
33
- return [...await this.cache.bestRemotes.getOrCreate(repoPath, async (_cacheable, aggregateSignal) => {
34
- const remotes = await this.getRemotesWithProviders(repoPath, { sort: true }, aggregateSignal);
35
- if (remotes.length === 0) return [];
36
- if (remotes.length === 1) return [...remotes];
33
+ return [...await this.cache.bestRemotes.getOrCreate(repoPath, async (cacheable, aggregateSignal) => {
34
+ const all = await this.getRemotes(repoPath, { sort: true }, aggregateSignal);
35
+ if (all.length === 0) {
36
+ cacheable.invalidate();
37
+ return [];
38
+ }
39
+ const remotes = all.filter((r) => r.provider != null);
40
+ if (remotes.length <= 1) return remotes;
37
41
  if (this.context.remotes?.sort != null) return this.context.remotes.sort(remotes, aggregateSignal);
38
42
  return remotes.toSorted((a, b) => sortCompare(a.name, b.name));
39
43
  }, cancellation)];
@@ -1 +1 @@
1
- {"version":3,"file":"remotes.js","names":[],"sources":["../../../../../git/src/providers/shared/remotes.ts"],"sourcesContent":["import { debug } from '@gitlens/utils/decorators/log.js';\nimport { sortCompare } from '@gitlens/utils/string.js';\nimport type { Cache } from '../../cache.js';\nimport type { GitServiceContext } from '../../context.js';\nimport type { GitRemote } from '../../models/remote.js';\nimport type { RemoteProvider } from '../../models/remoteProvider.js';\nimport { getDefaultRemoteOrHighlander } from '../../utils/remote.utils.js';\nimport type { GitProvider } from '../provider.js';\nimport type { GitRemotesSubProvider } from '../remotes.js';\n\nexport abstract class RemotesGitProviderBase implements GitRemotesSubProvider {\n\tconstructor(\n\t\tprotected readonly context: GitServiceContext,\n\t\tprotected readonly cache: Cache,\n\t\tprotected readonly provider: GitProvider,\n\t) {}\n\n\tabstract getRemotes(\n\t\trepoPath: string | undefined,\n\t\toptions?: { filter?: (remote: GitRemote) => boolean; sort?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote[]>;\n\n\t@debug({ quiet: true })\n\tasync getRemote(\n\t\trepoPath: string | undefined,\n\t\tname: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst remotes = await this.getRemotes(repoPath, undefined, cancellation);\n\t\treturn remotes.find(r => r.name === name);\n\t}\n\n\t@debug({ quiet: true })\n\tasync getDefaultRemote(repoPath: string, cancellation?: AbortSignal): Promise<GitRemote | undefined> {\n\t\tconst remotes = await this.getRemotes(repoPath, undefined, cancellation);\n\t\treturn getDefaultRemoteOrHighlander(remotes);\n\t}\n\n\t@debug({ quiet: true })\n\tasync getRemotesWithProviders(\n\t\trepoPath: string,\n\t\toptions?: { sort?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote<RemoteProvider>[]> {\n\t\tconst remotes = await this.getRemotes(repoPath, options, cancellation);\n\t\treturn remotes.filter((r): r is GitRemote<RemoteProvider> => r.provider != null);\n\t}\n\n\t@debug({ quiet: true })\n\tasync getBestRemoteWithProvider(\n\t\trepoPath: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote<RemoteProvider> | undefined> {\n\t\tconst remotes = await this.getBestRemotesWithProviders(repoPath, cancellation);\n\t\treturn remotes[0];\n\t}\n\n\t@debug({ quiet: true })\n\tasync getBestRemotesWithProviders(\n\t\trepoPath: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote<RemoteProvider>[]> {\n\t\tif (!repoPath) return [];\n\n\t\t// Derived from the remotes, so validated as their reads are (see `Cache.setReadValidator`)\n\t\tconst validation = this.cache.validateBeforeRead(repoPath);\n\t\tif (validation != null) {\n\t\t\tawait validation;\n\t\t}\n\n\t\tconst remotes = this.cache.bestRemotes.getOrCreate(\n\t\t\trepoPath,\n\t\t\tasync (_cacheable, aggregateSignal) => {\n\t\t\t\tconst remotes = await this.getRemotesWithProviders(repoPath, { sort: true }, aggregateSignal);\n\t\t\t\tif (remotes.length === 0) return [];\n\t\t\t\tif (remotes.length === 1) return [...remotes];\n\n\t\t\t\tif (this.context.remotes?.sort != null) {\n\t\t\t\t\treturn this.context.remotes.sort(remotes, aggregateSignal);\n\t\t\t\t}\n\n\t\t\t\t// Fallback: sort by name when no host sort is provided\n\t\t\t\treturn remotes.toSorted((a, b) => sortCompare(a.name, b.name));\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\n\t\treturn [...(await remotes)];\n\t}\n\n\t@debug()\n\tasync setRemoteAsDefault(repoPath: string, name: string, value: boolean = true): Promise<void> {\n\t\t// setGkConfig is optional — providers that don't support git config (e.g. GitHub) silently skip persistence\n\t\tawait this.provider.config.setGkConfig?.(repoPath, 'gk.defaultRemote', value ? name : undefined);\n\t\tthis.context.hooks?.cache?.onReset?.(repoPath, 'remotes');\n\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['remotes', 'remoteProviders']);\n\t}\n}\n"],"mappings":";;;;;AAUA,IAAsB,yBAAtB,MAA8E;CAEzD;CACA;CACA;CAHpB,YACC,SACA,OACA,UACC;EAHkB,KAAA,UAAA;EACA,KAAA,QAAA;EACA,KAAA,WAAA;CACjB;CAQH,MACM,UACL,UACA,MACA,cACiC;EACjC,IAAI,YAAY,MAAM,OAAO,KAAA;EAG7B,QAAO,MADe,KAAK,WAAW,UAAU,KAAA,GAAW,YAAY,EAAA,CACxD,MAAK,MAAK,EAAE,SAAS,IAAI;CACzC;CAEA,MACM,iBAAiB,UAAkB,cAA4D;EACpG,MAAM,UAAU,MAAM,KAAK,WAAW,UAAU,KAAA,GAAW,YAAY;E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K,CAAC,CAAA,GAAA,uBAAA,WAAA,oBAAA,IAAA;AAMrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,2BAAA,IAAA;AAUrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,6BAAA,IAAA;AASrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,+BAAA,IAAA;AAiCrB,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,sBAAA,IAAA"}
1
+ {"version":3,"file":"remotes.js","names":[],"sources":["../../../../../git/src/providers/shared/remotes.ts"],"sourcesContent":["import { debug } from '@gitlens/utils/decorators/log.js';\nimport { sortCompare } from '@gitlens/utils/string.js';\nimport type { Cache } from '../../cache.js';\nimport type { GitServiceContext } from '../../context.js';\nimport type { GitRemote } from '../../models/remote.js';\nimport type { RemoteProvider } from '../../models/remoteProvider.js';\nimport { getDefaultRemoteOrHighlander } from '../../utils/remote.utils.js';\nimport type { GitProvider } from '../provider.js';\nimport type { GitRemotesSubProvider } from '../remotes.js';\n\nexport abstract class RemotesGitProviderBase implements GitRemotesSubProvider {\n\tconstructor(\n\t\tprotected readonly context: GitServiceContext,\n\t\tprotected readonly cache: Cache,\n\t\tprotected readonly provider: GitProvider,\n\t) {}\n\n\tabstract getRemotes(\n\t\trepoPath: string | undefined,\n\t\toptions?: { filter?: (remote: GitRemote) => boolean; sort?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote[]>;\n\n\t@debug({ quiet: true })\n\tasync getRemote(\n\t\trepoPath: string | undefined,\n\t\tname: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst remotes = await this.getRemotes(repoPath, undefined, cancellation);\n\t\treturn remotes.find(r => r.name === name);\n\t}\n\n\t@debug({ quiet: true })\n\tasync getDefaultRemote(repoPath: string, cancellation?: AbortSignal): Promise<GitRemote | undefined> {\n\t\tconst remotes = await this.getRemotes(repoPath, undefined, cancellation);\n\t\treturn getDefaultRemoteOrHighlander(remotes);\n\t}\n\n\t@debug({ quiet: true })\n\tasync getRemotesWithProviders(\n\t\trepoPath: string,\n\t\toptions?: { sort?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote<RemoteProvider>[]> {\n\t\tconst remotes = await this.getRemotes(repoPath, options, cancellation);\n\t\treturn remotes.filter((r): r is GitRemote<RemoteProvider> => r.provider != null);\n\t}\n\n\t@debug({ quiet: true })\n\tasync getBestRemoteWithProvider(\n\t\trepoPath: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote<RemoteProvider> | undefined> {\n\t\tconst remotes = await this.getBestRemotesWithProviders(repoPath, cancellation);\n\t\treturn remotes[0];\n\t}\n\n\t@debug({ quiet: true })\n\tasync getBestRemotesWithProviders(\n\t\trepoPath: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitRemote<RemoteProvider>[]> {\n\t\tif (!repoPath) return [];\n\n\t\t// Derived from the remotes, so validated as their reads are (see `Cache.setReadValidator`)\n\t\tconst validation = this.cache.validateBeforeRead(repoPath);\n\t\tif (validation != null) {\n\t\t\tawait validation;\n\t\t}\n\n\t\tconst remotes = this.cache.bestRemotes.getOrCreate(\n\t\t\trepoPath,\n\t\t\tasync (cacheable, aggregateSignal) => {\n\t\t\t\tconst all = await this.getRemotes(repoPath, { sort: true }, aggregateSignal);\n\t\t\t\tif (all.length === 0) {\n\t\t\t\t\t// No remotes at all also means their listing failed, which isn't kept; the listing's own cached\n\t\t\t\t\t// answer covers a repository that truly has none without another git run\n\t\t\t\t\tcacheable.invalidate();\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst remotes = all.filter((r): r is GitRemote<RemoteProvider> => r.provider != null);\n\t\t\t\tif (remotes.length <= 1) return remotes;\n\n\t\t\t\tif (this.context.remotes?.sort != null) {\n\t\t\t\t\treturn this.context.remotes.sort(remotes, aggregateSignal);\n\t\t\t\t}\n\n\t\t\t\t// Fallback: sort by name when no host sort is provided\n\t\t\t\treturn remotes.toSorted((a, b) => sortCompare(a.name, b.name));\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\n\t\treturn [...(await remotes)];\n\t}\n\n\t@debug()\n\tasync setRemoteAsDefault(repoPath: string, name: string, value: boolean = true): Promise<void> {\n\t\t// setGkConfig is optional — providers that don't support git config (e.g. GitHub) silently skip persistence\n\t\tawait this.provider.config.setGkConfig?.(repoPath, 'gk.defaultRemote', value ? name : undefined);\n\t\tthis.context.hooks?.cache?.onReset?.(repoPath, 'remotes');\n\t\tthis.context.hooks?.repository?.onChanged?.(repoPath, ['remotes', 'remoteProviders']);\n\t}\n}\n"],"mappings":";;;;;AAUA,IAAsB,yBAAtB,MAA8E;CAEzD;CACA;CACA;CAHpB,YACC,SACA,OACA,UACC;EAHkB,KAAA,UAAA;EACA,KAAA,QAAA;EACA,KAAA,WAAA;CACjB;CAQH,MACM,UACL,UACA,MACA,cACiC;EACjC,IAAI,YAAY,MAAM,OAAO,KAAA;EAG7B,QAAO,MADe,KAAK,WAAW,UAAU,KAAA,GAAW,YAAY,EAAA,CACxD,MAAK,MAAK,EAAE,SAAS,IAAI;CACzC;CAEA,MACM,iBAAiB,UAAkB,cAA4D;EACpG,MAAM,UAAU,MAAM,KAAK,WAAW,UAAU,KAAA,GAAW,YAAY;EACvE,OAAO,6BAA6B,OAAO;CAC5C;CAEA,MACM,wBACL,UACA,SACA,cACuC;EAEvC,QAAO,MADe,KAAK,WAAW,UAAU,SAAS,YAAY,EAAA,CACtD,QAAQ,MAAsC,EAAE,YAAY,IAAI;CAChF;CAEA,MACM,0BACL,UACA,cACiD;EAEjD,QAAO,MADe,KAAK,4BAA4B,UAAU,YAAY,EAAA,CAC9D;CAChB;CAEA,MACM,4BACL,UACA,cACuC;EACvC,IAAI,CAAC,UAAU,OAAO,CAAC;E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O,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,+BAAA,IAAA;AAwCrB,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,sBAAA,IAAA"}
@@ -12,7 +12,7 @@ import { GoogleSourceRemoteProvider } from "./google-source.js";
12
12
  const builtInProviders = [
13
13
  {
14
14
  custom: false,
15
- matcher: "bitbucket.org",
15
+ matcher: /^(?:ssh\.)?bitbucket\.org$/i,
16
16
  type: "bitbucket"
17
17
  },
18
18
  {
@@ -75,7 +75,7 @@ function createProvider(entry, domain, path, scheme, context) {
75
75
  function createBuiltInProvider(type, domain, path, protocol, name, custom, context) {
76
76
  switch (type) {
77
77
  case "azure-devops": return new AzureDevOpsRemoteProvider(domain, path, protocol, name, isVsts(domain), context);
78
- case "bitbucket": return new BitbucketRemoteProvider(domain, path, protocol, name, custom, context);
78
+ case "bitbucket": return new BitbucketRemoteProvider(domain.toLowerCase() === "ssh.bitbucket.org" ? "bitbucket.org" : domain, path, protocol, name, custom, context);
79
79
  case "bitbucket-server": return new BitbucketServerRemoteProvider(domain, path, protocol, name, custom, context);
80
80
  case "custom": return;
81
81
  case "gerrit": return new GerritRemoteProvider(domain, path, protocol, name, custom, void 0, context);
@@ -1 +1 @@
1
- {"version":3,"file":"matcher.js","names":[],"sources":["../../../../git/src/remotes/matcher.ts"],"sourcesContent":["import { Logger } from '@gitlens/utils/logger.js';\nimport type { RemoteProviderContext } from '../context.js';\nimport type {\n\tRemoteProvider,\n\tRemoteProviderId,\n\tRemoteProviderMatcher,\n\tRemotesUrlsConfig,\n} from '../models/remoteProvider.js';\nimport { AzureDevOpsRemoteProvider, isVsts } from './azure-devops.js';\nimport { BitbucketServerRemoteProvider } from './bitbucket-server.js';\nimport { BitbucketRemoteProvider } from './bitbucket.js';\nimport { CustomRemoteProvider } from './custom.js';\nimport { GerritRemoteProvider } from './gerrit.js';\nimport { GiteaRemoteProvider } from './gitea.js';\nimport { GitHubRemoteProvider } from './github.js';\nimport { GitLabRemoteProvider } from './gitlab.js';\nimport { GoogleSourceRemoteProvider } from './google-source.js';\n\nexport type { RemoteProviderMatcher } from '../models/remoteProvider.js';\n\n/**\n * Configuration for a remote provider, provided by the host.\n * The library uses these to build a {@link RemoteProviderMatcher} internally.\n *\n * Each config describes either a user-configured custom remote (from settings)\n * or a cloud self-managed host (from integration descriptors).\n */\nexport interface RemoteProviderConfig {\n\treadonly type: RemoteProviderId;\n\t/** Domain for exact string matching (mutually exclusive with `regex`) */\n\treadonly domain?: string;\n\t/** Regex pattern for flexible matching (mutually exclusive with `domain`) */\n\treadonly regex?: string;\n\t/** URL protocol override (e.g., `'https'`) */\n\treadonly protocol?: string;\n\t/** Display name override */\n\treadonly name?: string;\n\t/** Custom URL templates — required when `type` is `'Custom'` */\n\treadonly urls?: RemotesUrlsConfig;\n}\n\ninterface ProviderEntry {\n\tcustom: boolean;\n\t/** When true, the regex is also tested against the full URL (not just the domain) */\n\tmatchUrl?: boolean;\n\tmatcher: string | RegExp;\n\ttype: RemoteProviderId;\n\tprotocol?: string;\n\tname?: string;\n\turls?: RemotesUrlsConfig;\n}\n\nconst builtInProviders: ProviderEntry[] = [\n\t{ custom: false, matcher: 'bitbucket.org', type: 'bitbucket' },\n\t{ custom: false, matcher: 'github.com', type: 'github' },\n\t{ custom: false, matcher: 'gitlab.com', type: 'gitlab' },\n\t{ custom: false, matcher: /\\bdev\\.azure\\.com$/i, type: 'azure-devops' },\n\t{ custom: false, matchUrl: true, matcher: /^(.+\\/(?:bitbucket|stash))\\/scm\\/(.+)$/i, type: 'bitbucket-server' },\n\t{ custom: false, matcher: /\\bgitlab\\b/i, type: 'gitlab' },\n\t{ custom: false, matcher: /\\bvisualstudio\\.com$/i, type: 'azure-devops' },\n\t{ custom: false, matcher: /\\bgitea\\b/i, type: 'gitea' },\n\t{ custom: false, matcher: /\\bgerrithub\\.io$/i, type: 'gerrit' },\n\t{ custom: false, matcher: /\\bgooglesource\\.com$/i, type: 'google-source' },\n];\n\nconst protocolRegex = /(\\w+)\\W*/;\nfunction cleanProtocol(scheme: string | undefined): string | undefined {\n\tconst protocol = scheme?.match(protocolRegex)?.[1];\n\t// Only preserve web protocols; non-web schemes (e.g. `ssh`, `git`) must fall back to the\n\t// provider's default so web URLs (commit/issue/PR pages) don't inherit an unreachable scheme\n\treturn protocol === 'http' || protocol === 'https' ? protocol : undefined;\n}\n\nfunction createProvider(\n\tentry: ProviderEntry,\n\tdomain: string,\n\tpath: string,\n\tscheme: string | undefined,\n\tcontext?: RemoteProviderContext,\n): RemoteProvider | undefined {\n\tconst protocol = cleanProtocol(entry.protocol ?? scheme);\n\n\tif (entry.type === 'custom' && entry.urls != null) {\n\t\treturn new CustomRemoteProvider(domain, path, entry.urls, protocol, entry.name);\n\t}\n\n\treturn createBuiltInProvider(entry.type, domain, path, protocol, entry.name, entry.custom, context);\n}\n\nfunction createBuiltInProvider(\n\ttype: RemoteProviderId,\n\tdomain: string,\n\tpath: string,\n\tprotocol?: string,\n\tname?: string,\n\tcustom?: boolean,\n\tcontext?: RemoteProviderContext,\n): RemoteProvider | undefined {\n\tswitch (type) {\n\t\tcase 'azure-devops':\n\t\t\treturn new AzureDevOpsRemoteProvider(domain, path, protocol, name, isVsts(domain), context);\n\t\tcase 'bitbucket':\n\t\t\treturn new BitbucketRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'bitbucket-server':\n\t\t\treturn new BitbucketServerRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'custom':\n\t\t\treturn undefined; // Custom requires urls — handled in config entries\n\t\tcase 'gerrit':\n\t\t\treturn new GerritRemoteProvider(domain, path, protocol, name, custom, undefined, context);\n\t\tcase 'google-source':\n\t\t\treturn new GoogleSourceRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'gitea':\n\t\t\treturn new GiteaRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'github':\n\t\t\treturn new GitHubRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'gitlab':\n\t\t\treturn new GitLabRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nfunction configsToEntries(configs: RemoteProviderConfig[]): ProviderEntry[] {\n\tconst entries: ProviderEntry[] = [];\n\tfor (const cfg of configs) {\n\t\tlet matcher: string | RegExp | undefined;\n\t\ttry {\n\t\t\tmatcher = cfg.regex ? new RegExp(cfg.regex, 'i') : cfg.domain?.toLowerCase();\n\t\t\tif (matcher == null) {\n\t\t\t\tLogger.error(undefined, `Remote provider config for '${cfg.name ?? cfg.type}' has no domain or regex`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tLogger.error(ex, `Loading remote provider config '${cfg.name ?? cfg.type}' failed`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tentries.push({\n\t\t\tcustom: true,\n\t\t\tmatchUrl: true,\n\t\t\tmatcher: matcher,\n\t\t\ttype: cfg.type,\n\t\t\tprotocol: cfg.protocol,\n\t\t\tname: cfg.name,\n\t\t\turls: cfg.urls,\n\t\t});\n\t}\n\treturn entries;\n}\n\nfunction matchEntries(\n\tentries: ProviderEntry[],\n\turl: string,\n\tdomain: string,\n\tpath: string,\n\tscheme: string | undefined,\n\thooks?: RemoteProviderContext,\n): RemoteProvider | undefined {\n\tconst key = domain?.toLowerCase();\n\tfor (const entry of entries) {\n\t\tif (typeof entry.matcher === 'string') {\n\t\t\tif (entry.matcher === key) {\n\t\t\t\treturn createProvider(entry, domain, path, scheme, hooks);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (entry.matcher.test(key)) {\n\t\t\treturn createProvider(entry, domain, path, scheme, hooks);\n\t\t}\n\t\tif (!entry.matchUrl) continue;\n\n\t\tconst match = entry.matcher.exec(url);\n\t\tif (match != null) {\n\t\t\tconst matchDomain = match[1].replace(/^[a-zA-Z][\\w+.-]*:\\/\\//, '');\n\t\t\treturn createProvider(entry, matchDomain, match[2], scheme, hooks);\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Creates a {@link RemoteProviderMatcher} from optional extra configs and built-in providers.\n *\n * Extra configs (from user settings or cloud integrations) are matched first, then built-ins.\n * The optional {@link RemoteProviderContext} is attached to each created provider so it can\n * call host-side providers (e.g., cross-fork PR URLs, autolink decoration).\n *\n * @param configs - Extra provider configs beyond built-ins (user custom remotes, cloud self-managed hosts)\n * @param context - Optional host-provided context to attach to created providers\n */\nexport function createRemoteProviderMatcher(\n\tconfigs?: RemoteProviderConfig[],\n\tcontext?: RemoteProviderContext,\n): RemoteProviderMatcher {\n\tconst extraEntries = configs?.length ? configsToEntries(configs) : undefined;\n\n\treturn (url: string, domain: string, path: string, scheme: string | undefined): RemoteProvider | undefined => {\n\t\ttry {\n\t\t\t// Try extra configs first (user-configured + cloud self-managed take priority)\n\t\t\tif (extraEntries != null) {\n\t\t\t\tconst provider = matchEntries(extraEntries, url, domain, path, scheme, context);\n\t\t\t\tif (provider != null) return provider;\n\t\t\t}\n\n\t\t\t// Fall back to built-in providers\n\t\t\treturn matchEntries(builtInProviders, url, domain, path, scheme, context);\n\t\t} catch (ex) {\n\t\t\tdebugger;\n\t\t\tLogger.error(ex, 'createRemoteProviderMatcher');\n\t\t\treturn undefined;\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAoDA,MAAM,mBAAoC;CACzC;EAAE,QAAQ;EAAO,SAAS;EAAiB,MAAM;CAAY;CAC7D;EAAE,QAAQ;EAAO,SAAS;EAAc,MAAM;CAAS;CACvD;EAAE,QAAQ;EAAO,SAAS;EAAc,MAAM;CAAS;CACvD;EAAE,QAAQ;EAAO,SAAS;EAAuB,MAAM;CAAe;CACtE;EAAE,QAAQ;EAAO,UAAU;EAAM,SAAS;EAA2C,MAAM;CAAmB;CAC9G;EAAE,QAAQ;EAAO,SAAS;EAAe,MAAM;CAAS;CACxD;EAAE,QAAQ;EAAO,SAAS;EAAyB,MAAM;CAAe;CACxE;EAAE,QAAQ;EAAO,SAAS;EAAc,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,OAAO,IAAI,KAAA;CAEnE,QAAQ,KAAa,QAAgB,MAAc,WAA2D;EAC7G,IAAI;GAEH,IAAI,gBAAgB,MAAM;IACzB,MAAM,WAAW,aAAa,cAAc,KAAK,QAAQ,MAAM,QAAQ,OAAO;IAC9E,IAAI,YAAY,MAAM,OAAO;GAC9B;GAGA,OAAO,aAAa,kBAAkB,KAAK,QAAQ,MAAM,QAAQ,OAAO;EACzE,SAAS,IAAI;GACZ;GACA,QAAO,MAAM,IAAI,6BAA6B;GAC9C;EACD;CACD;AACD"}
1
+ {"version":3,"file":"matcher.js","names":[],"sources":["../../../../git/src/remotes/matcher.ts"],"sourcesContent":["import { Logger } from '@gitlens/utils/logger.js';\nimport type { RemoteProviderContext } from '../context.js';\nimport type {\n\tRemoteProvider,\n\tRemoteProviderId,\n\tRemoteProviderMatcher,\n\tRemotesUrlsConfig,\n} from '../models/remoteProvider.js';\nimport { AzureDevOpsRemoteProvider, isVsts } from './azure-devops.js';\nimport { BitbucketServerRemoteProvider } from './bitbucket-server.js';\nimport { BitbucketRemoteProvider } from './bitbucket.js';\nimport { CustomRemoteProvider } from './custom.js';\nimport { GerritRemoteProvider } from './gerrit.js';\nimport { GiteaRemoteProvider } from './gitea.js';\nimport { GitHubRemoteProvider } from './github.js';\nimport { GitLabRemoteProvider } from './gitlab.js';\nimport { GoogleSourceRemoteProvider } from './google-source.js';\n\nexport type { RemoteProviderMatcher } from '../models/remoteProvider.js';\n\n/**\n * Configuration for a remote provider, provided by the host.\n * The library uses these to build a {@link RemoteProviderMatcher} internally.\n *\n * Each config describes either a user-configured custom remote (from settings)\n * or a cloud self-managed host (from integration descriptors).\n */\nexport interface RemoteProviderConfig {\n\treadonly type: RemoteProviderId;\n\t/** Domain for exact string matching (mutually exclusive with `regex`) */\n\treadonly domain?: string;\n\t/** Regex pattern for flexible matching (mutually exclusive with `domain`) */\n\treadonly regex?: string;\n\t/** URL protocol override (e.g., `'https'`) */\n\treadonly protocol?: string;\n\t/** Display name override */\n\treadonly name?: string;\n\t/** Custom URL templates — required when `type` is `'Custom'` */\n\treadonly urls?: RemotesUrlsConfig;\n}\n\ninterface ProviderEntry {\n\tcustom: boolean;\n\t/** When true, the regex is also tested against the full URL (not just the domain) */\n\tmatchUrl?: boolean;\n\tmatcher: string | RegExp;\n\ttype: RemoteProviderId;\n\tprotocol?: string;\n\tname?: string;\n\turls?: RemotesUrlsConfig;\n}\n\nconst builtInProviders: ProviderEntry[] = [\n\t{ custom: false, matcher: /^(?:ssh\\.)?bitbucket\\.org$/i, type: 'bitbucket' },\n\t{ custom: false, matcher: 'github.com', type: 'github' },\n\t{ custom: false, matcher: 'gitlab.com', type: 'gitlab' },\n\t{ custom: false, matcher: /\\bdev\\.azure\\.com$/i, type: 'azure-devops' },\n\t{ custom: false, matchUrl: true, matcher: /^(.+\\/(?:bitbucket|stash))\\/scm\\/(.+)$/i, type: 'bitbucket-server' },\n\t{ custom: false, matcher: /\\bgitlab\\b/i, type: 'gitlab' },\n\t{ custom: false, matcher: /\\bvisualstudio\\.com$/i, type: 'azure-devops' },\n\t{ custom: false, matcher: /\\bgitea\\b/i, type: 'gitea' },\n\t{ custom: false, matcher: /\\bgerrithub\\.io$/i, type: 'gerrit' },\n\t{ custom: false, matcher: /\\bgooglesource\\.com$/i, type: 'google-source' },\n];\n\nconst protocolRegex = /(\\w+)\\W*/;\nfunction cleanProtocol(scheme: string | undefined): string | undefined {\n\tconst protocol = scheme?.match(protocolRegex)?.[1];\n\t// Only preserve web protocols; non-web schemes (e.g. `ssh`, `git`) must fall back to the\n\t// provider's default so web URLs (commit/issue/PR pages) don't inherit an unreachable scheme\n\treturn protocol === 'http' || protocol === 'https' ? protocol : undefined;\n}\n\nfunction createProvider(\n\tentry: ProviderEntry,\n\tdomain: string,\n\tpath: string,\n\tscheme: string | undefined,\n\tcontext?: RemoteProviderContext,\n): RemoteProvider | undefined {\n\tconst protocol = cleanProtocol(entry.protocol ?? scheme);\n\n\tif (entry.type === 'custom' && entry.urls != null) {\n\t\treturn new CustomRemoteProvider(domain, path, entry.urls, protocol, entry.name);\n\t}\n\n\treturn createBuiltInProvider(entry.type, domain, path, protocol, entry.name, entry.custom, context);\n}\n\nfunction createBuiltInProvider(\n\ttype: RemoteProviderId,\n\tdomain: string,\n\tpath: string,\n\tprotocol?: string,\n\tname?: string,\n\tcustom?: boolean,\n\tcontext?: RemoteProviderContext,\n): RemoteProvider | undefined {\n\tswitch (type) {\n\t\tcase 'azure-devops':\n\t\t\treturn new AzureDevOpsRemoteProvider(domain, path, protocol, name, isVsts(domain), context);\n\t\tcase 'bitbucket':\n\t\t\treturn new BitbucketRemoteProvider(\n\t\t\t\tdomain.toLowerCase() === 'ssh.bitbucket.org' ? 'bitbucket.org' : domain,\n\t\t\t\tpath,\n\t\t\t\tprotocol,\n\t\t\t\tname,\n\t\t\t\tcustom,\n\t\t\t\tcontext,\n\t\t\t);\n\t\tcase 'bitbucket-server':\n\t\t\treturn new BitbucketServerRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'custom':\n\t\t\treturn undefined; // Custom requires urls — handled in config entries\n\t\tcase 'gerrit':\n\t\t\treturn new GerritRemoteProvider(domain, path, protocol, name, custom, undefined, context);\n\t\tcase 'google-source':\n\t\t\treturn new GoogleSourceRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'gitea':\n\t\t\treturn new GiteaRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'github':\n\t\t\treturn new GitHubRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tcase 'gitlab':\n\t\t\treturn new GitLabRemoteProvider(domain, path, protocol, name, custom, context);\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nfunction configsToEntries(configs: RemoteProviderConfig[]): ProviderEntry[] {\n\tconst entries: ProviderEntry[] = [];\n\tfor (const cfg of configs) {\n\t\tlet matcher: string | RegExp | undefined;\n\t\ttry {\n\t\t\tmatcher = cfg.regex ? new RegExp(cfg.regex, 'i') : cfg.domain?.toLowerCase();\n\t\t\tif (matcher == null) {\n\t\t\t\tLogger.error(undefined, `Remote provider config for '${cfg.name ?? cfg.type}' has no domain or regex`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tLogger.error(ex, `Loading remote provider config '${cfg.name ?? cfg.type}' failed`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tentries.push({\n\t\t\tcustom: true,\n\t\t\tmatchUrl: true,\n\t\t\tmatcher: matcher,\n\t\t\ttype: cfg.type,\n\t\t\tprotocol: cfg.protocol,\n\t\t\tname: cfg.name,\n\t\t\turls: cfg.urls,\n\t\t});\n\t}\n\treturn entries;\n}\n\nfunction matchEntries(\n\tentries: ProviderEntry[],\n\turl: string,\n\tdomain: string,\n\tpath: string,\n\tscheme: string | undefined,\n\thooks?: RemoteProviderContext,\n): RemoteProvider | undefined {\n\tconst key = domain?.toLowerCase();\n\tfor (const entry of entries) {\n\t\tif (typeof entry.matcher === 'string') {\n\t\t\tif (entry.matcher === key) {\n\t\t\t\treturn createProvider(entry, domain, path, scheme, hooks);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (entry.matcher.test(key)) {\n\t\t\treturn createProvider(entry, domain, path, scheme, hooks);\n\t\t}\n\t\tif (!entry.matchUrl) continue;\n\n\t\tconst match = entry.matcher.exec(url);\n\t\tif (match != null) {\n\t\t\tconst matchDomain = match[1].replace(/^[a-zA-Z][\\w+.-]*:\\/\\//, '');\n\t\t\treturn createProvider(entry, matchDomain, match[2], scheme, hooks);\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Creates a {@link RemoteProviderMatcher} from optional extra configs and built-in providers.\n *\n * Extra configs (from user settings or cloud integrations) are matched first, then built-ins.\n * The optional {@link RemoteProviderContext} is attached to each created provider so it can\n * call host-side providers (e.g., cross-fork PR URLs, autolink decoration).\n *\n * @param configs - Extra provider configs beyond built-ins (user custom remotes, cloud self-managed hosts)\n * @param context - Optional host-provided context to attach to created providers\n */\nexport function createRemoteProviderMatcher(\n\tconfigs?: RemoteProviderConfig[],\n\tcontext?: RemoteProviderContext,\n): RemoteProviderMatcher {\n\tconst extraEntries = configs?.length ? configsToEntries(configs) : undefined;\n\n\treturn (url: string, domain: string, path: string, scheme: string | undefined): RemoteProvider | undefined => {\n\t\ttry {\n\t\t\t// Try extra configs first (user-configured + cloud self-managed take priority)\n\t\t\tif (extraEntries != null) {\n\t\t\t\tconst provider = matchEntries(extraEntries, url, domain, path, scheme, context);\n\t\t\t\tif (provider != null) return provider;\n\t\t\t}\n\n\t\t\t// Fall back to built-in providers\n\t\t\treturn matchEntries(builtInProviders, url, domain, path, scheme, context);\n\t\t} catch (ex) {\n\t\t\tdebugger;\n\t\t\tLogger.error(ex, 'createRemoteProviderMatcher');\n\t\t\treturn undefined;\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAoDA,MAAM,mBAAoC;CACzC;EAAE,QAAQ;EAAO,SAAS;EAA+B,MAAM;CAAY;CAC3E;EAAE,QAAQ;EAAO,SAAS;EAAc,MAAM;CAAS;CACvD;EAAE,QAAQ;EAAO,SAAS;EAAc,MAAM;CAAS;CACvD;EAAE,QAAQ;EAAO,SAAS;EAAuB,MAAM;CAAe;CACtE;EAAE,QAAQ;EAAO,UAAU;EAAM,SAAS;EAA2C,MAAM;CAAmB;CAC9G;EAAE,QAAQ;EAAO,SAAS;EAAe,MAAM;CAAS;CACxD;EAAE,QAAQ;EAAO,SAAS;EAAyB,MAAM;CAAe;CACxE;EAAE,QAAQ;EAAO,SAAS;EAAc,MAAM;CAAQ;CACtD;EAAE,QAAQ;EAAO,SAAS;EAAqB,MAAM;CAAS;CAC9D;EAAE,QAAQ;EAAO,SAAS;EAAyB,MAAM;CAAgB;AAC1E;AAEA,MAAM,gBAAgB;AACtB,SAAS,cAAc,QAAgD;CACtE,MAAM,WAAW,QAAQ,MAAM,aAAa,CAAC,GAAG;CAGhD,OAAO,aAAa,UAAU,aAAa,UAAU,WAAW,KAAA;AAC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AAQ,OAAO;EACzE,SAAS,IAAI;GACZ;GACA,QAAO,MAAM,IAAI,6BAA6B;GAC9C;EACD;CACD;AACD"}
@@ -111,6 +111,14 @@ type OmitFirstArg<F, First = any> = F extends {
111
111
  * Property optionality is preserved automatically by the mapped-type `[K in keyof T]`.
112
112
  */
113
113
  export type SubProviderForRepo<T> = { [K in keyof T]: NonNullable<T[K]> extends ((...args: any[]) => any) ? OmitFirstArg<NonNullable<T[K]>, string> : T[K]; };
114
+ /** The names of {@link RepositoryService}'s sub-providers */
115
+ export type SubProviderName = Exclude<keyof RepositoryService, 'path' | 'provider' | 'getAbsoluteUri' | 'etagWorkingTree'>;
116
+ /**
117
+ * Per sub-provider, the methods that call straight through while their checkout's registration is in flight; every
118
+ * other method waits on it. Each list must name exactly the sub-provider's {@link CallThroughMethodsOf}, which the
119
+ * build checks.
120
+ */
121
+ export declare const subProviderCallThroughMethods: { readonly [K in SubProviderName]: ReadonlySet<string>; };
114
122
  /**
115
123
  * Creates a repo-scoped wrapper for a sub-provider.
116
124
  * Returns a plain object where every method is pre-bound with `repoPath` as the first argument.
@@ -119,10 +127,17 @@ export type SubProviderForRepo<T> = { [K in keyof T]: NonNullable<T[K]> extends
119
127
  * The proxy automatically injects `repoPath` as the first argument to all method calls.
120
128
  * Operations that don't take `repoPath` (like `clone`) belong on `GitProvider` directly.
121
129
  *
130
+ * With `registration`, each call first asks `ensureRegistered` (see `GitProvider.ensureRegistered`); while it answers
131
+ * a promise, a method not in `callThrough` starts once it settles, and one in it starts at once.
132
+ *
122
133
  * @param target The sub-provider to wrap
123
134
  * @param repoPath The repository path to auto-inject
135
+ * @param registration How to ask that `repoPath` be registered, and the methods that must not wait on it
124
136
  * @returns A wrapped sub-provider where repoPath is pre-bound to all methods
125
137
  */
126
- export declare function createSubProviderProxyForRepo<T extends object>(target: T, repoPath: string): SubProviderForRepo<T>;
138
+ export declare function createSubProviderProxyForRepo<T extends object>(target: T, repoPath: string, registration?: {
139
+ ensureRegistered: () => Promise<void> | undefined;
140
+ callThrough: ReadonlySet<string>;
141
+ }): SubProviderForRepo<T>;
127
142
  //#endregion
128
143
  //# sourceMappingURL=repositoryService.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { exhaustiveArray } from "../utils/array.js";
1
2
  //#region ../git/src/repositoryService.ts
2
3
  let _repositoryServiceResolver;
3
4
  /** Clears the global repository resolver */
@@ -24,6 +25,37 @@ function setGlobalRepositoryServiceResolver(resolver) {
24
25
  _repositoryServiceResolver = resolver;
25
26
  }
26
27
  /**
28
+ * Per sub-provider, the methods that call straight through while their checkout's registration is in flight; every
29
+ * other method waits on it. Each list must name exactly the sub-provider's {@link CallThroughMethodsOf}, which the
30
+ * build checks.
31
+ */
32
+ const subProviderCallThroughMethods = {
33
+ branches: new Set(exhaustiveArray()([])),
34
+ commits: new Set(exhaustiveArray()([])),
35
+ config: /* @__PURE__ */ new Set([
36
+ ...exhaustiveArray()(["getSigningConfigFlags"]),
37
+ "getGitDir",
38
+ "getRepositoryInfo",
39
+ "resolveGitDirWithoutGit"
40
+ ]),
41
+ contributors: new Set(exhaustiveArray()([])),
42
+ diff: new Set(exhaustiveArray()([])),
43
+ graph: new Set(exhaustiveArray()(["searchGraph", "continueSearchGraph"])),
44
+ refs: new Set(exhaustiveArray()([])),
45
+ remotes: new Set(exhaustiveArray()([])),
46
+ revision: new Set(exhaustiveArray()([])),
47
+ status: new Set(exhaustiveArray()([])),
48
+ tags: new Set(exhaustiveArray()([])),
49
+ blame: new Set(exhaustiveArray()([])),
50
+ maintenance: new Set(exhaustiveArray()(["request"])),
51
+ ops: new Set(exhaustiveArray()(["scheduleIndexRefresh"])),
52
+ patch: new Set(exhaustiveArray()([])),
53
+ pausedOps: new Set(exhaustiveArray()([])),
54
+ staging: new Set(exhaustiveArray()([])),
55
+ stash: new Set(exhaustiveArray()([])),
56
+ worktrees: new Set(exhaustiveArray()(["getWorktreesDefaultUri"]))
57
+ };
58
+ /**
27
59
  * Creates a repo-scoped wrapper for a sub-provider.
28
60
  * Returns a plain object where every method is pre-bound with `repoPath` as the first argument.
29
61
  *
@@ -31,11 +63,15 @@ function setGlobalRepositoryServiceResolver(resolver) {
31
63
  * The proxy automatically injects `repoPath` as the first argument to all method calls.
32
64
  * Operations that don't take `repoPath` (like `clone`) belong on `GitProvider` directly.
33
65
  *
66
+ * With `registration`, each call first asks `ensureRegistered` (see `GitProvider.ensureRegistered`); while it answers
67
+ * a promise, a method not in `callThrough` starts once it settles, and one in it starts at once.
68
+ *
34
69
  * @param target The sub-provider to wrap
35
70
  * @param repoPath The repository path to auto-inject
71
+ * @param registration How to ask that `repoPath` be registered, and the methods that must not wait on it
36
72
  * @returns A wrapped sub-provider where repoPath is pre-bound to all methods
37
73
  */
38
- function createSubProviderProxyForRepo(target, repoPath) {
74
+ function createSubProviderProxyForRepo(target, repoPath, registration) {
39
75
  const bound = Object.create(null);
40
76
  let proto = target;
41
77
  while (proto != null && proto !== Object.prototype) {
@@ -44,14 +80,26 @@ function createSubProviderProxyForRepo(target, repoPath) {
44
80
  const desc = Object.getOwnPropertyDescriptor(proto, key);
45
81
  if (desc?.value != null && typeof desc.value === "function") {
46
82
  const fn = desc.value;
47
- bound[key] = (...args) => fn.call(target, repoPath, ...args);
83
+ bound[key] = bindMethod(target, repoPath, key, fn, registration);
48
84
  }
49
85
  }
50
86
  proto = Object.getPrototypeOf(proto);
51
87
  }
52
88
  return bound;
53
89
  }
90
+ function bindMethod(target, repoPath, key, fn, registration) {
91
+ if (registration == null) return (...args) => fn.call(target, repoPath, ...args);
92
+ const { ensureRegistered } = registration;
93
+ if (typeof key !== "string" || registration.callThrough.has(key)) return (...args) => {
94
+ ensureRegistered();
95
+ return fn.call(target, repoPath, ...args);
96
+ };
97
+ return (...args) => {
98
+ const pending = ensureRegistered();
99
+ return pending != null ? pending.then(() => fn.call(target, repoPath, ...args)) : fn.call(target, repoPath, ...args);
100
+ };
101
+ }
54
102
  //#endregion
55
- export { clearGlobalRepositoryServiceResolver, createSubProviderProxyForRepo, getRepositoryService, setGlobalRepositoryServiceResolver };
103
+ export { clearGlobalRepositoryServiceResolver, createSubProviderProxyForRepo, getRepositoryService, setGlobalRepositoryServiceResolver, subProviderCallThroughMethods };
56
104
 
57
105
  //# sourceMappingURL=repositoryService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"repositoryService.js","names":[],"sources":["../../../git/src/repositoryService.ts"],"sourcesContent":["import type { Uri } from '@gitlens/utils/uri.js';\nimport type { GitProvider, GitProviderDescriptor } from './providers/provider.js';\n\n/**\n * A repo-scoped view of a {@link GitProvider}'s sub-providers.\n *\n * Every sub-provider method has its `repoPath` parameter auto-injected,\n * so callers don't need to pass the repository path repeatedly.\n *\n * Created lazily by {@link GitService.forRepo} and cached\n * for proxy reuse. The service trusts the caller — if the path isn't\n * a real repository, git commands will fail naturally.\n *\n * @example\n * ```typescript\n * const repo = service.forRepo('/path/to/repo');\n * const branches = await repo.branches.getBranches(); // repoPath auto-injected\n * const status = await repo.status.getStatus();\n * ```\n */\nexport interface RepositoryService {\n\t/** Normalized path or URI-string identifying the repository root */\n\treadonly path: string;\n\t/** Descriptor of the provider that manages this repository */\n\treadonly provider: GitProviderDescriptor;\n\n\t/** Resolves a relative path within this repository to an absolute URI */\n\tgetAbsoluteUri(relativePath: string): Uri;\n\n\t/**\n\t * Monotonic counter tracking working tree filesystem changes.\n\t * Used by `GitCommit.hasFullDetails()` for uncommitted commit staleness.\n\t * Returns `undefined` when no watch service is configured (headless/test).\n\t */\n\treadonly etagWorkingTree: number | undefined;\n\n\t// Required sub-providers (repoPath auto-injected)\n\treadonly branches: SubProviderForRepo<GitProvider['branches']>;\n\treadonly commits: SubProviderForRepo<GitProvider['commits']>;\n\treadonly config: SubProviderForRepo<GitProvider['config']>;\n\treadonly contributors: SubProviderForRepo<GitProvider['contributors']>;\n\treadonly diff: SubProviderForRepo<GitProvider['diff']>;\n\treadonly graph: SubProviderForRepo<GitProvider['graph']>;\n\treadonly refs: SubProviderForRepo<GitProvider['refs']>;\n\treadonly remotes: SubProviderForRepo<GitProvider['remotes']>;\n\treadonly revision: SubProviderForRepo<GitProvider['revision']>;\n\treadonly status: SubProviderForRepo<GitProvider['status']>;\n\treadonly tags: SubProviderForRepo<GitProvider['tags']>;\n\n\t// Optional sub-providers\n\treadonly blame?: SubProviderForRepo<NonNullable<GitProvider['blame']>>;\n\treadonly maintenance?: SubProviderForRepo<NonNullable<GitProvider['maintenance']>>;\n\treadonly ops?: SubProviderForRepo<NonNullable<GitProvider['ops']>>;\n\treadonly patch?: SubProviderForRepo<NonNullable<GitProvider['patch']>>;\n\treadonly pausedOps?: SubProviderForRepo<NonNullable<GitProvider['pausedOps']>>;\n\treadonly staging?: SubProviderForRepo<NonNullable<GitProvider['staging']>>;\n\treadonly stash?: SubProviderForRepo<NonNullable<GitProvider['stash']>>;\n\treadonly worktrees?: SubProviderForRepo<NonNullable<GitProvider['worktrees']>>;\n}\n\nlet _repositoryServiceResolver: ((repoPath: string) => RepositoryService | undefined) | undefined;\n\n/** Clears the global repository resolver */\nexport function clearGlobalRepositoryServiceResolver(): void {\n\t_repositoryServiceResolver = undefined;\n}\n\n/**\n * Returns a repo-scoped {@link RepositoryService} for the given path.\n * Returns undefined if no resolver is configured or the path is unrecognized.\n *\n * @warning This function depends on {@link setGlobalRepositoryServiceResolver} being called at startup.\n * If called before configuration, it will return undefined. Ensure proper initialization order.\n */\nexport function getRepositoryService(repoPath: string): RepositoryService | undefined {\n\treturn _repositoryServiceResolver?.(repoPath);\n}\n\n/**\n * Sets a global repository resolver for models\n * Call this at application startup to enable model-level\n * repository access (e.g., {@link GitWorktree.hasWorkingChanges}).\n * @internal Called by {@link GitService} constructor.\n */\nexport function setGlobalRepositoryServiceResolver(\n\tresolver: (repoPath: string) => RepositoryService | undefined,\n): void {\n\t_repositoryServiceResolver = resolver;\n}\n\n/**\n * Utility for creating repo-scoped sub-provider wrappers.\n *\n * **Contract:** Every method on a sub-provider must accept `repoPath: string` as its\n * first parameter. The proxy auto-injects `repoPath` so callers don't have to pass it\n * repeatedly. Methods that don't take `repoPath` (e.g. `clone`) belong on `GitProvider`\n * directly, not on a sub-provider interface.\n *\n * @example\n * ```typescript\n * const branches = createSubProviderProxyForRepo(provider.branches, '/repo/path');\n * // Now: branches.getBranch('main') instead of provider.branches.getBranch('/repo/path', 'main')\n * ```\n */\n\n// Note: OmitFirstArg handles function overloads (up to 4 deep).\n// This is needed because some sub-provider methods have overloaded signatures.\n// The `First` type parameter constrains what the first argument must extend —\n// pass `string` to enforce that every method takes `repoPath: string` as its first parameter.\ntype OmitFirstArg<F, First = any> = F extends {\n\t(first: First, ...args: infer A1): infer R1;\n\t(first: First, ...args: infer A2): infer R2;\n\t(first: First, ...args: infer A3): infer R3;\n\t(first: First, ...args: infer A4): infer R4;\n}\n\t? ((...args: A1) => R1) & ((...args: A2) => R2) & ((...args: A3) => R3) & ((...args: A4) => R4)\n\t: F extends {\n\t\t\t\t(first: First, ...args: infer A1): infer R1;\n\t\t\t\t(first: First, ...args: infer A2): infer R2;\n\t\t\t\t(first: First, ...args: infer A3): infer R3;\n\t\t }\n\t\t? ((...args: A1) => R1) & ((...args: A2) => R2) & ((...args: A3) => R3)\n\t\t: F extends {\n\t\t\t\t\t(first: First, ...args: infer A1): infer R1;\n\t\t\t\t\t(first: First, ...args: infer A2): infer R2;\n\t\t\t }\n\t\t\t? ((...args: A1) => R1) & ((...args: A2) => R2)\n\t\t\t: F extends {\n\t\t\t\t\t\t(first: First, ...args: infer A1): infer R1;\n\t\t\t\t }\n\t\t\t\t? (...args: A1) => R1\n\t\t\t\t: never;\n\n/**\n * Transforms a sub-provider type by removing the first `repoPath` parameter\n * from every method signature. Used to create repo-scoped views of sub-providers.\n *\n * Passes `string` as the `First` constraint to `OmitFirstArg`, which enforces that\n * every method on the sub-provider takes `string` (i.e. `repoPath`) as its first\n * parameter. Methods that don't will produce `never`, causing a compile error at call sites.\n *\n * Uses `NonNullable` before the conditional check so that optional methods\n * (whose type includes `| undefined`) are still matched and transformed.\n * Property optionality is preserved automatically by the mapped-type `[K in keyof T]`.\n */\nexport type SubProviderForRepo<T> = {\n\t[K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? OmitFirstArg<NonNullable<T[K]>, string> : T[K];\n};\n\n/**\n * Creates a repo-scoped wrapper for a sub-provider.\n * Returns a plain object where every method is pre-bound with `repoPath` as the first argument.\n *\n * Every method on the sub-provider must declare `repoPath: string` as its FIRST parameter.\n * The proxy automatically injects `repoPath` as the first argument to all method calls.\n * Operations that don't take `repoPath` (like `clone`) belong on `GitProvider` directly.\n *\n * @param target The sub-provider to wrap\n * @param repoPath The repository path to auto-inject\n * @returns A wrapped sub-provider where repoPath is pre-bound to all methods\n */\nexport function createSubProviderProxyForRepo<T extends object>(target: T, repoPath: string): SubProviderForRepo<T> {\n\tconst bound: Record<string | symbol, unknown> = Object.create(null);\n\n\tlet proto: object | null = target;\n\twhile (proto != null && proto !== Object.prototype) {\n\t\tfor (const key of Reflect.ownKeys(proto)) {\n\t\t\tif (key === 'constructor' || key in bound) continue;\n\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, key);\n\t\t\tif (desc?.value != null && typeof desc.value === 'function') {\n\t\t\t\tconst fn = desc.value as (...args: unknown[]) => unknown;\n\t\t\t\tbound[key] = (...args: unknown[]) => fn.call(target, repoPath, ...args);\n\t\t\t}\n\t\t}\n\t\tproto = Object.getPrototypeOf(proto) as object | null;\n\t}\n\n\treturn bound as unknown as SubProviderForRepo<T>;\n}\n"],"mappings":";AA4DA,IAAI;;AAGJ,SAAgB,uCAA6C;CAC5D,6BAA6B,KAAA;AAC9B;;;;;;;;AASA,SAAgB,qBAAqB,UAAiD;CACrF,OAAO,6BAA6B,QAAQ;AAC7C;;;;;;;AAQA,SAAgB,mCACf,UACO;CACP,6BAA6B;AAC9B;;;;;;;;;;;;;AAyEA,SAAgB,8BAAgD,QAAW,UAAyC;CACnH,MAAM,QAA0C,OAAO,OAAO,IAAI;CAElE,IAAI,QAAuB;CAC3B,OAAO,SAAS,QAAQ,UAAU,OAAO,WAAW;EACnD,KAAK,MAAM,OAAO,QAAQ,QAAQ,KAAK,GAAG;GACzC,IAAI,QAAQ,iBAAiB,OAAO,OAAO;GAE3C,MAAM,OAAO,OAAO,yBAAyB,OAAO,GAAG;GACvD,IAAI,MAAM,SAAS,QAAQ,OAAO,KAAK,UAAU,YAAY;IAC5D,MAAM,KAAK,KAAK;IAChB,MAAM,QAAQ,GAAG,SAAoB,GAAG,KAAK,QAAQ,UAAU,GAAG,IAAI;GACvE;EACD;EACA,QAAQ,OAAO,eAAe,KAAK;CACpC;CAEA,OAAO;AACR"}
1
+ {"version":3,"file":"repositoryService.js","names":[],"sources":["../../../git/src/repositoryService.ts"],"sourcesContent":["import { exhaustiveArray } from '@gitlens/utils/array.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport type { GitProvider, GitProviderDescriptor } from './providers/provider.js';\n\n/**\n * A repo-scoped view of a {@link GitProvider}'s sub-providers.\n *\n * Every sub-provider method has its `repoPath` parameter auto-injected,\n * so callers don't need to pass the repository path repeatedly.\n *\n * Created lazily by {@link GitService.forRepo} and cached\n * for proxy reuse. The service trusts the caller — if the path isn't\n * a real repository, git commands will fail naturally.\n *\n * @example\n * ```typescript\n * const repo = service.forRepo('/path/to/repo');\n * const branches = await repo.branches.getBranches(); // repoPath auto-injected\n * const status = await repo.status.getStatus();\n * ```\n */\nexport interface RepositoryService {\n\t/** Normalized path or URI-string identifying the repository root */\n\treadonly path: string;\n\t/** Descriptor of the provider that manages this repository */\n\treadonly provider: GitProviderDescriptor;\n\n\t/** Resolves a relative path within this repository to an absolute URI */\n\tgetAbsoluteUri(relativePath: string): Uri;\n\n\t/**\n\t * Monotonic counter tracking working tree filesystem changes.\n\t * Used by `GitCommit.hasFullDetails()` for uncommitted commit staleness.\n\t * Returns `undefined` when no watch service is configured (headless/test).\n\t */\n\treadonly etagWorkingTree: number | undefined;\n\n\t// Required sub-providers (repoPath auto-injected)\n\treadonly branches: SubProviderForRepo<GitProvider['branches']>;\n\treadonly commits: SubProviderForRepo<GitProvider['commits']>;\n\treadonly config: SubProviderForRepo<GitProvider['config']>;\n\treadonly contributors: SubProviderForRepo<GitProvider['contributors']>;\n\treadonly diff: SubProviderForRepo<GitProvider['diff']>;\n\treadonly graph: SubProviderForRepo<GitProvider['graph']>;\n\treadonly refs: SubProviderForRepo<GitProvider['refs']>;\n\treadonly remotes: SubProviderForRepo<GitProvider['remotes']>;\n\treadonly revision: SubProviderForRepo<GitProvider['revision']>;\n\treadonly status: SubProviderForRepo<GitProvider['status']>;\n\treadonly tags: SubProviderForRepo<GitProvider['tags']>;\n\n\t// Optional sub-providers\n\treadonly blame?: SubProviderForRepo<NonNullable<GitProvider['blame']>>;\n\treadonly maintenance?: SubProviderForRepo<NonNullable<GitProvider['maintenance']>>;\n\treadonly ops?: SubProviderForRepo<NonNullable<GitProvider['ops']>>;\n\treadonly patch?: SubProviderForRepo<NonNullable<GitProvider['patch']>>;\n\treadonly pausedOps?: SubProviderForRepo<NonNullable<GitProvider['pausedOps']>>;\n\treadonly staging?: SubProviderForRepo<NonNullable<GitProvider['staging']>>;\n\treadonly stash?: SubProviderForRepo<NonNullable<GitProvider['stash']>>;\n\treadonly worktrees?: SubProviderForRepo<NonNullable<GitProvider['worktrees']>>;\n}\n\nlet _repositoryServiceResolver: ((repoPath: string) => RepositoryService | undefined) | undefined;\n\n/** Clears the global repository resolver */\nexport function clearGlobalRepositoryServiceResolver(): void {\n\t_repositoryServiceResolver = undefined;\n}\n\n/**\n * Returns a repo-scoped {@link RepositoryService} for the given path.\n * Returns undefined if no resolver is configured or the path is unrecognized.\n *\n * @warning This function depends on {@link setGlobalRepositoryServiceResolver} being called at startup.\n * If called before configuration, it will return undefined. Ensure proper initialization order.\n */\nexport function getRepositoryService(repoPath: string): RepositoryService | undefined {\n\treturn _repositoryServiceResolver?.(repoPath);\n}\n\n/**\n * Sets a global repository resolver for models\n * Call this at application startup to enable model-level\n * repository access (e.g., {@link GitWorktree.hasWorkingChanges}).\n * @internal Called by {@link GitService} constructor.\n */\nexport function setGlobalRepositoryServiceResolver(\n\tresolver: (repoPath: string) => RepositoryService | undefined,\n): void {\n\t_repositoryServiceResolver = resolver;\n}\n\n/**\n * Utility for creating repo-scoped sub-provider wrappers.\n *\n * **Contract:** Every method on a sub-provider must accept `repoPath: string` as its\n * first parameter. The proxy auto-injects `repoPath` so callers don't have to pass it\n * repeatedly. Methods that don't take `repoPath` (e.g. `clone`) belong on `GitProvider`\n * directly, not on a sub-provider interface.\n *\n * @example\n * ```typescript\n * const branches = createSubProviderProxyForRepo(provider.branches, '/repo/path');\n * // Now: branches.getBranch('main') instead of provider.branches.getBranch('/repo/path', 'main')\n * ```\n */\n\n// Note: OmitFirstArg handles function overloads (up to 4 deep).\n// This is needed because some sub-provider methods have overloaded signatures.\n// The `First` type parameter constrains what the first argument must extend —\n// pass `string` to enforce that every method takes `repoPath: string` as its first parameter.\ntype OmitFirstArg<F, First = any> = F extends {\n\t(first: First, ...args: infer A1): infer R1;\n\t(first: First, ...args: infer A2): infer R2;\n\t(first: First, ...args: infer A3): infer R3;\n\t(first: First, ...args: infer A4): infer R4;\n}\n\t? ((...args: A1) => R1) & ((...args: A2) => R2) & ((...args: A3) => R3) & ((...args: A4) => R4)\n\t: F extends {\n\t\t\t\t(first: First, ...args: infer A1): infer R1;\n\t\t\t\t(first: First, ...args: infer A2): infer R2;\n\t\t\t\t(first: First, ...args: infer A3): infer R3;\n\t\t }\n\t\t? ((...args: A1) => R1) & ((...args: A2) => R2) & ((...args: A3) => R3)\n\t\t: F extends {\n\t\t\t\t\t(first: First, ...args: infer A1): infer R1;\n\t\t\t\t\t(first: First, ...args: infer A2): infer R2;\n\t\t\t }\n\t\t\t? ((...args: A1) => R1) & ((...args: A2) => R2)\n\t\t\t: F extends {\n\t\t\t\t\t\t(first: First, ...args: infer A1): infer R1;\n\t\t\t\t }\n\t\t\t\t? (...args: A1) => R1\n\t\t\t\t: never;\n\n/**\n * Transforms a sub-provider type by removing the first `repoPath` parameter\n * from every method signature. Used to create repo-scoped views of sub-providers.\n *\n * Passes `string` as the `First` constraint to `OmitFirstArg`, which enforces that\n * every method on the sub-provider takes `string` (i.e. `repoPath`) as its first\n * parameter. Methods that don't will produce `never`, causing a compile error at call sites.\n *\n * Uses `NonNullable` before the conditional check so that optional methods\n * (whose type includes `| undefined`) are still matched and transformed.\n * Property optionality is preserved automatically by the mapped-type `[K in keyof T]`.\n */\nexport type SubProviderForRepo<T> = {\n\t[K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? OmitFirstArg<NonNullable<T[K]>, string> : T[K];\n};\n\n/** The names of {@link RepositoryService}'s sub-providers */\nexport type SubProviderName = Exclude<\n\tkeyof RepositoryService,\n\t'path' | 'provider' | 'getAbsoluteUri' | 'etagWorkingTree'\n>;\n\n/** The return types of a method's signatures (up to 4 overloads, as {@link OmitFirstArg}) */\ntype ReturnTypesOf<F> = F extends {\n\t(...args: never[]): infer R1;\n\t(...args: never[]): infer R2;\n\t(...args: never[]): infer R3;\n\t(...args: never[]): infer R4;\n}\n\t? R1 | R2 | R3 | R4\n\t: F extends (...args: never[]) => infer R\n\t\t? R\n\t\t: never;\n\n/** The members of `R` that are not a plain `Promise`: not one at all, or one carrying more (a cancel method, say) */\ntype NotPlainPromise<R> = R extends Promise<infer V> ? ([Promise<V>] extends [R] ? never : R) : R;\n\n/**\n * The methods of sub-provider `T` that must not wait on a registration (see `Cache.setRepoPathRegistrar`): every one\n * whose signatures answer anything other than a plain `Promise` (a value, `void`, a union with one, an async\n * iterable), since wrapping it in `.then` would change what it answers\n */\ntype CallThroughMethodsOf<T> = {\n\t[K in keyof T]-?: NonNullable<T[K]> extends (...args: never[]) => unknown\n\t\t? [NotPlainPromise<ReturnTypesOf<NonNullable<T[K]>>>] extends [never]\n\t\t\t? never\n\t\t\t: K\n\t\t: never;\n}[keyof T];\n\n/**\n * Per sub-provider, the methods that call straight through while their checkout's registration is in flight; every\n * other method waits on it. Each list must name exactly the sub-provider's {@link CallThroughMethodsOf}, which the\n * build checks.\n */\nexport const subProviderCallThroughMethods: { readonly [K in SubProviderName]: ReadonlySet<string> } = {\n\tbranches: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['branches']>>()([])),\n\tcommits: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['commits']>>()([])),\n\tconfig: new Set<string>([\n\t\t...exhaustiveArray<CallThroughMethodsOf<GitProvider['config']>>()(['getSigningConfigFlags']),\n\t\t// What a registrar resolves the git dir it registers with: waiting would wait on its own registration\n\t\t'getGitDir',\n\t\t'getRepositoryInfo',\n\t\t'resolveGitDirWithoutGit',\n\t]),\n\tcontributors: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['contributors']>>()([])),\n\tdiff: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['diff']>>()([])),\n\tgraph: new Set(\n\t\texhaustiveArray<CallThroughMethodsOf<GitProvider['graph']>>()(['searchGraph', 'continueSearchGraph']),\n\t),\n\trefs: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['refs']>>()([])),\n\tremotes: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['remotes']>>()([])),\n\trevision: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['revision']>>()([])),\n\tstatus: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['status']>>()([])),\n\ttags: new Set(exhaustiveArray<CallThroughMethodsOf<GitProvider['tags']>>()([])),\n\tblame: new Set(exhaustiveArray<CallThroughMethodsOf<NonNullable<GitProvider['blame']>>>()([])),\n\tmaintenance: new Set(exhaustiveArray<CallThroughMethodsOf<NonNullable<GitProvider['maintenance']>>>()(['request'])),\n\tops: new Set(exhaustiveArray<CallThroughMethodsOf<NonNullable<GitProvider['ops']>>>()(['scheduleIndexRefresh'])),\n\tpatch: new Set(exhaustiveArray<CallThroughMethodsOf<NonNullable<GitProvider['patch']>>>()([])),\n\tpausedOps: new Set(exhaustiveArray<CallThroughMethodsOf<NonNullable<GitProvider['pausedOps']>>>()([])),\n\tstaging: new Set(exhaustiveArray<CallThroughMethodsOf<NonNullable<GitProvider['staging']>>>()([])),\n\tstash: new Set(exhaustiveArray<CallThroughMethodsOf<NonNullable<GitProvider['stash']>>>()([])),\n\tworktrees: new Set(\n\t\texhaustiveArray<CallThroughMethodsOf<NonNullable<GitProvider['worktrees']>>>()(['getWorktreesDefaultUri']),\n\t),\n};\n\n/**\n * Creates a repo-scoped wrapper for a sub-provider.\n * Returns a plain object where every method is pre-bound with `repoPath` as the first argument.\n *\n * Every method on the sub-provider must declare `repoPath: string` as its FIRST parameter.\n * The proxy automatically injects `repoPath` as the first argument to all method calls.\n * Operations that don't take `repoPath` (like `clone`) belong on `GitProvider` directly.\n *\n * With `registration`, each call first asks `ensureRegistered` (see `GitProvider.ensureRegistered`); while it answers\n * a promise, a method not in `callThrough` starts once it settles, and one in it starts at once.\n *\n * @param target The sub-provider to wrap\n * @param repoPath The repository path to auto-inject\n * @param registration How to ask that `repoPath` be registered, and the methods that must not wait on it\n * @returns A wrapped sub-provider where repoPath is pre-bound to all methods\n */\nexport function createSubProviderProxyForRepo<T extends object>(\n\ttarget: T,\n\trepoPath: string,\n\tregistration?: { ensureRegistered: () => Promise<void> | undefined; callThrough: ReadonlySet<string> },\n): SubProviderForRepo<T> {\n\tconst bound: Record<string | symbol, unknown> = Object.create(null);\n\n\tlet proto: object | null = target;\n\twhile (proto != null && proto !== Object.prototype) {\n\t\tfor (const key of Reflect.ownKeys(proto)) {\n\t\t\tif (key === 'constructor' || key in bound) continue;\n\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, key);\n\t\t\tif (desc?.value != null && typeof desc.value === 'function') {\n\t\t\t\tconst fn = desc.value as (...args: unknown[]) => unknown;\n\t\t\t\tbound[key] = bindMethod(target, repoPath, key, fn, registration);\n\t\t\t}\n\t\t}\n\t\tproto = Object.getPrototypeOf(proto) as object | null;\n\t}\n\n\treturn bound as unknown as SubProviderForRepo<T>;\n}\n\nfunction bindMethod(\n\ttarget: object,\n\trepoPath: string,\n\tkey: string | symbol,\n\tfn: (...args: unknown[]) => unknown,\n\tregistration: { ensureRegistered: () => Promise<void> | undefined; callThrough: ReadonlySet<string> } | undefined,\n): (...args: unknown[]) => unknown {\n\tif (registration == null) return (...args: unknown[]) => fn.call(target, repoPath, ...args);\n\n\tconst { ensureRegistered } = registration;\n\tif (typeof key !== 'string' || registration.callThrough.has(key)) {\n\t\treturn (...args: unknown[]) => {\n\t\t\tvoid ensureRegistered();\n\t\t\treturn fn.call(target, repoPath, ...args);\n\t\t};\n\t}\n\n\treturn (...args: unknown[]) => {\n\t\tconst pending = ensureRegistered();\n\t\treturn pending != null\n\t\t\t? pending.then(() => fn.call(target, repoPath, ...args))\n\t\t\t: fn.call(target, repoPath, ...args);\n\t};\n}\n"],"mappings":";;AA6DA,IAAI;;AAGJ,SAAgB,uCAA6C;CAC5D,6BAA6B,KAAA;AAC9B;;;;;;;;AASA,SAAgB,qBAAqB,UAAiD;CACrF,OAAO,6BAA6B,QAAQ;AAC7C;;;;;;;AAQA,SAAgB,mCACf,UACO;CACP,6BAA6B;AAC9B;;;;;;AAoGA,MAAa,gCAA0F;CACtG,UAAU,IAAI,IAAI,gBAA+D,CAAC,CAAC,CAAC,CAAC,CAAC;CACtF,SAAS,IAAI,IAAI,gBAA8D,CAAC,CAAC,CAAC,CAAC,CAAC;CACpF,wBAAQ,IAAI,IAAY;EACvB,GAAG,gBAA6D,CAAC,CAAC,CAAC,uBAAuB,CAAC;EAE3F;EACA;EACA;CACD,CAAC;CACD,cAAc,IAAI,IAAI,gBAAmE,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9F,MAAM,IAAI,IAAI,gBAA2D,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9E,OAAO,IAAI,IACV,gBAA4D,CAAC,CAAC,CAAC,eAAe,qBAAqB,CAAC,CACrG;CACA,MAAM,IAAI,IAAI,gBAA2D,CAAC,C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YAAY;GAChE;EACD;EACA,QAAQ,OAAO,eAAe,KAAK;CACpC;CAEA,OAAO;AACR;AAEA,SAAS,WACR,QACA,UACA,KACA,IACA,cACkC;CAClC,IAAI,gBAAgB,MAAM,QAAQ,GAAG,SAAoB,GAAG,KAAK,QAAQ,UAAU,GAAG,IAAI;CAE1F,MAAM,EAAE,qBAAqB;CAC7B,IAAI,OAAO,QAAQ,YAAY,aAAa,YAAY,IAAI,GAAG,GAC9D,QAAQ,GAAG,SAAoB;EAC9B,iBAAsB;EACtB,OAAO,GAAG,KAAK,QAAQ,UAAU,GAAG,IAAI;CACzC;CAGD,QAAQ,GAAG,SAAoB;EAC9B,MAAM,UAAU,iBAAiB;EACjC,OAAO,WAAW,OACf,QAAQ,WAAW,GAAG,KAAK,QAAQ,UAAU,GAAG,IAAI,CAAC,IACrD,GAAG,KAAK,QAAQ,UAAU,GAAG,IAAI;CACrC;AACD"}
@@ -173,6 +173,7 @@ export interface GitRunOptions {
173
173
  cwd?: string;
174
174
  readonly env?: Record<string, string | undefined>;
175
175
  readonly encoding?: BufferEncoding | 'buffer' | string;
176
+ /** The most bytes each of stdout and stderr may produce, else the run is killed and rejects; unlimited if absent */
176
177
  readonly maxBuffer?: number;
177
178
  readonly stdin?: string | Buffer;
178
179
  readonly stdinEncoding?: string;
@@ -2,7 +2,7 @@ import { createDisposable } from "../utils/disposable.js";
2
2
  import { Emitter } from "../utils/event.js";
3
3
  import { getRepositoryKey } from "../utils/uri.js";
4
4
  import { normalizePath } from "../utils/path.js";
5
- import { clearGlobalRepositoryServiceResolver, createSubProviderProxyForRepo, setGlobalRepositoryServiceResolver } from "./repositoryService.js";
5
+ import { clearGlobalRepositoryServiceResolver, createSubProviderProxyForRepo, setGlobalRepositoryServiceResolver, subProviderCallThroughMethods } from "./repositoryService.js";
6
6
  import { RepositoryWatchService } from "./watching/watchService.js";
7
7
  import { WorktreeSummaryService } from "./watching/worktreeSummary.js";
8
8
  //#region ../git/src/service.ts
@@ -260,11 +260,15 @@ var GitService = class GitService {
260
260
  };
261
261
  function createRepositoryService(provider, repoPath, watchService) {
262
262
  const proxies = /* @__PURE__ */ new Map();
263
+ const ensureRegistered = provider.ensureRegistered != null ? () => provider.ensureRegistered?.(repoPath) : void 0;
263
264
  function getProxy(prop, subProvider) {
264
265
  if (subProvider == null) return void 0;
265
266
  let proxy = proxies.get(prop);
266
267
  if (proxy == null) {
267
- proxy = createSubProviderProxyForRepo(subProvider, repoPath);
268
+ proxy = createSubProviderProxyForRepo(subProvider, repoPath, ensureRegistered != null ? {
269
+ ensureRegistered,
270
+ callThrough: subProviderCallThroughMethods[prop]
271
+ } : void 0);
268
272
  proxies.set(prop, proxy);
269
273
  }
270
274
  return proxy;