@gitkraken/core-gitlens 0.2.0 → 0.3.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 (448) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/dist/git/cache.d.ts +38 -8
  3. package/dist/git/cache.d.ts.map +1 -1
  4. package/dist/git/cache.js +120 -55
  5. package/dist/git/cache.js.map +1 -1
  6. package/dist/git/context.d.ts +19 -0
  7. package/dist/git/context.d.ts.map +1 -1
  8. package/dist/git/context.js.map +1 -1
  9. package/dist/git/features.d.ts +1 -1
  10. package/dist/git/features.d.ts.map +1 -1
  11. package/dist/git/features.js +1 -0
  12. package/dist/git/features.js.map +1 -1
  13. package/dist/git/models/commit.d.ts.map +1 -1
  14. package/dist/git/models/commit.js.map +1 -1
  15. package/dist/git/models/graph.d.ts +96 -0
  16. package/dist/git/models/graph.d.ts.map +1 -1
  17. package/dist/git/models/graph.js +24 -1
  18. package/dist/git/models/graph.js.map +1 -1
  19. package/dist/git/models/reference.d.ts +31 -0
  20. package/dist/git/models/reference.d.ts.map +1 -1
  21. package/dist/git/models/remote.d.ts.map +1 -1
  22. package/dist/git/models/remote.js.map +1 -1
  23. package/dist/git/models/remoteProvider.d.ts +1 -0
  24. package/dist/git/models/remoteProvider.d.ts.map +1 -1
  25. package/dist/git/models/remoteProvider.js.map +1 -1
  26. package/dist/git/models/repository.d.ts +30 -13
  27. package/dist/git/models/repository.d.ts.map +1 -1
  28. package/dist/git/models/repository.js +89 -87
  29. package/dist/git/models/repository.js.map +1 -1
  30. package/dist/git/models/search.d.ts +2 -2
  31. package/dist/git/models/search.d.ts.map +1 -1
  32. package/dist/git/models/statusFile.d.ts +9 -0
  33. package/dist/git/models/statusFile.d.ts.map +1 -1
  34. package/dist/git/models/statusFile.js +11 -0
  35. package/dist/git/models/statusFile.js.map +1 -1
  36. package/dist/git/models/worktree.d.ts +4 -1
  37. package/dist/git/models/worktree.d.ts.map +1 -1
  38. package/dist/git/models/worktree.js +2 -2
  39. package/dist/git/models/worktree.js.map +1 -1
  40. package/dist/git/parsers/diffParser.d.ts.map +1 -1
  41. package/dist/git/parsers/diffParser.js.map +1 -1
  42. package/dist/git/providers/branches.d.ts +15 -4
  43. package/dist/git/providers/branches.d.ts.map +1 -1
  44. package/dist/git/providers/commits.d.ts +4 -0
  45. package/dist/git/providers/commits.d.ts.map +1 -1
  46. package/dist/git/providers/config.d.ts +5 -4
  47. package/dist/git/providers/config.d.ts.map +1 -1
  48. package/dist/git/providers/operations.d.ts +61 -12
  49. package/dist/git/providers/operations.d.ts.map +1 -1
  50. package/dist/git/providers/pausedOperations.d.ts +3 -1
  51. package/dist/git/providers/pausedOperations.d.ts.map +1 -1
  52. package/dist/git/providers/refs.d.ts +23 -2
  53. package/dist/git/providers/refs.d.ts.map +1 -1
  54. package/dist/git/providers/staging.d.ts +16 -0
  55. package/dist/git/providers/staging.d.ts.map +1 -1
  56. package/dist/git/providers/status.d.ts +4 -1
  57. package/dist/git/providers/status.d.ts.map +1 -1
  58. package/dist/git/remotes/azure-devops.d.ts.map +1 -1
  59. package/dist/git/remotes/azure-devops.js.map +1 -1
  60. package/dist/git/remotes/custom.d.ts +2 -0
  61. package/dist/git/remotes/custom.d.ts.map +1 -1
  62. package/dist/git/remotes/custom.js +20 -0
  63. package/dist/git/remotes/custom.js.map +1 -1
  64. package/dist/git/{exec.types.d.ts → run.types.d.ts} +22 -3
  65. package/dist/git/run.types.d.ts.map +1 -0
  66. package/dist/git/run.types.js +2 -0
  67. package/dist/git/run.types.js.map +1 -0
  68. package/dist/git/service.d.ts.map +1 -1
  69. package/dist/git/service.js.map +1 -1
  70. package/dist/git/utils/autolink.utils.d.ts.map +1 -1
  71. package/dist/git/utils/autolink.utils.js.map +1 -1
  72. package/dist/git/utils/blame.utils.d.ts.map +1 -1
  73. package/dist/git/utils/blame.utils.js.map +1 -1
  74. package/dist/git/utils/conflictResolution.utils.d.ts +6 -0
  75. package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -0
  76. package/dist/git/utils/conflictResolution.utils.js +25 -0
  77. package/dist/git/utils/conflictResolution.utils.js.map +1 -0
  78. package/dist/git/utils/contributor.utils.d.ts +3 -0
  79. package/dist/git/utils/contributor.utils.d.ts.map +1 -1
  80. package/dist/git/utils/contributor.utils.js +22 -0
  81. package/dist/git/utils/contributor.utils.js.map +1 -1
  82. package/dist/git/utils/fileStatus.utils.d.ts +2 -1
  83. package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
  84. package/dist/git/utils/fileStatus.utils.js +4 -0
  85. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  86. package/dist/git/utils/reachability.utils.d.ts +37 -0
  87. package/dist/git/utils/reachability.utils.d.ts.map +1 -0
  88. package/dist/git/utils/reachability.utils.js +96 -0
  89. package/dist/git/utils/reachability.utils.js.map +1 -0
  90. package/dist/git/utils/search.utils.d.ts.map +1 -1
  91. package/dist/git/utils/search.utils.js +3 -0
  92. package/dist/git/utils/search.utils.js.map +1 -1
  93. package/dist/git/utils/sorting.d.ts +8 -0
  94. package/dist/git/utils/sorting.d.ts.map +1 -1
  95. package/dist/git/utils/sorting.js +15 -0
  96. package/dist/git/utils/sorting.js.map +1 -1
  97. package/dist/git/utils/status.utils.d.ts.map +1 -1
  98. package/dist/git/utils/status.utils.js.map +1 -1
  99. package/dist/git/watching/classifyChange.d.ts.map +1 -1
  100. package/dist/git/watching/classifyChange.js +8 -0
  101. package/dist/git/watching/classifyChange.js.map +1 -1
  102. package/dist/git/watching/gitIgnoreFilter.js +1 -1
  103. package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
  104. package/dist/git/watching/initWatcher.d.ts.map +1 -1
  105. package/dist/git/watching/initWatcher.js.map +1 -1
  106. package/dist/git/watching/watchGroup.d.ts.map +1 -1
  107. package/dist/git/watching/watchGroup.js.map +1 -1
  108. package/dist/git/watching/watchService.d.ts +4 -2
  109. package/dist/git/watching/watchService.d.ts.map +1 -1
  110. package/dist/git/watching/watchService.js +31 -6
  111. package/dist/git/watching/watchService.js.map +1 -1
  112. package/dist/git/watching/watchSession.d.ts +14 -12
  113. package/dist/git/watching/watchSession.d.ts.map +1 -1
  114. package/dist/git/watching/watchSession.js +56 -55
  115. package/dist/git/watching/watchSession.js.map +1 -1
  116. package/dist/git-cli/exec/exec.types.d.ts +1 -1
  117. package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
  118. package/dist/git-cli/exec/git.d.ts +3 -3
  119. package/dist/git-cli/exec/git.d.ts.map +1 -1
  120. package/dist/git-cli/exec/git.js.map +1 -1
  121. package/dist/git-cli/exec/gitQueue.d.ts +10 -2
  122. package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
  123. package/dist/git-cli/exec/gitQueue.js +39 -12
  124. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  125. package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
  126. package/dist/git-cli/parsers/blameParser.js.map +1 -1
  127. package/dist/git-cli/parsers/logParser.js.map +1 -1
  128. package/dist/git-cli/parsers/refParser.d.ts +3 -30
  129. package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
  130. package/dist/git-cli/parsers/refParser.js +30 -30
  131. package/dist/git-cli/parsers/refParser.js.map +1 -1
  132. package/dist/git-cli/providers/blame.d.ts.map +1 -1
  133. package/dist/git-cli/providers/blame.js.map +1 -1
  134. package/dist/git-cli/providers/branches.d.ts +15 -5
  135. package/dist/git-cli/providers/branches.d.ts.map +1 -1
  136. package/dist/git-cli/providers/branches.js +99 -68
  137. package/dist/git-cli/providers/branches.js.map +1 -1
  138. package/dist/git-cli/providers/commits.d.ts +1 -0
  139. package/dist/git-cli/providers/commits.d.ts.map +1 -1
  140. package/dist/git-cli/providers/commits.js +86 -30
  141. package/dist/git-cli/providers/commits.js.map +1 -1
  142. package/dist/git-cli/providers/config.d.ts +19 -6
  143. package/dist/git-cli/providers/config.d.ts.map +1 -1
  144. package/dist/git-cli/providers/config.js +86 -38
  145. package/dist/git-cli/providers/config.js.map +1 -1
  146. package/dist/git-cli/providers/diff.d.ts.map +1 -1
  147. package/dist/git-cli/providers/diff.js +5 -3
  148. package/dist/git-cli/providers/diff.js.map +1 -1
  149. package/dist/git-cli/providers/graph.d.ts.map +1 -1
  150. package/dist/git-cli/providers/graph.js +139 -16
  151. package/dist/git-cli/providers/graph.js.map +1 -1
  152. package/dist/git-cli/providers/operations.d.ts +17 -14
  153. package/dist/git-cli/providers/operations.d.ts.map +1 -1
  154. package/dist/git-cli/providers/operations.js +135 -63
  155. package/dist/git-cli/providers/operations.js.map +1 -1
  156. package/dist/git-cli/providers/patch.d.ts.map +1 -1
  157. package/dist/git-cli/providers/patch.js.map +1 -1
  158. package/dist/git-cli/providers/pausedOperations.d.ts +3 -1
  159. package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
  160. package/dist/git-cli/providers/pausedOperations.js +7 -1
  161. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  162. package/dist/git-cli/providers/refs.d.ts +19 -2
  163. package/dist/git-cli/providers/refs.d.ts.map +1 -1
  164. package/dist/git-cli/providers/refs.js +286 -2
  165. package/dist/git-cli/providers/refs.js.map +1 -1
  166. package/dist/git-cli/providers/revision.js.map +1 -1
  167. package/dist/git-cli/providers/staging.d.ts +6 -0
  168. package/dist/git-cli/providers/staging.d.ts.map +1 -1
  169. package/dist/git-cli/providers/staging.js +32 -0
  170. package/dist/git-cli/providers/staging.js.map +1 -1
  171. package/dist/git-cli/providers/stash.d.ts.map +1 -1
  172. package/dist/git-cli/providers/stash.js +20 -2
  173. package/dist/git-cli/providers/stash.js.map +1 -1
  174. package/dist/git-cli/providers/status.d.ts +4 -1
  175. package/dist/git-cli/providers/status.d.ts.map +1 -1
  176. package/dist/git-cli/providers/status.js +8 -4
  177. package/dist/git-cli/providers/status.js.map +1 -1
  178. package/dist/git-cli/providers/tags.d.ts.map +1 -1
  179. package/dist/git-cli/providers/tags.js +10 -6
  180. package/dist/git-cli/providers/tags.js.map +1 -1
  181. package/dist/ipc/discovery.d.ts +49 -0
  182. package/dist/ipc/discovery.d.ts.map +1 -0
  183. package/dist/ipc/discovery.js +147 -0
  184. package/dist/ipc/discovery.js.map +1 -0
  185. package/dist/ipc/ipcServer.d.ts +20 -0
  186. package/dist/ipc/ipcServer.d.ts.map +1 -0
  187. package/dist/ipc/ipcServer.js +162 -0
  188. package/dist/ipc/ipcServer.js.map +1 -0
  189. package/dist/plus/agents/providers/claudeCodeProvider.d.ts +167 -0
  190. package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -0
  191. package/dist/plus/agents/providers/claudeCodeProvider.js +1786 -0
  192. package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -0
  193. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +36 -0
  194. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -0
  195. package/dist/plus/agents/providers/claudeCodeTranscript.js +171 -0
  196. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -0
  197. package/dist/plus/agents/sanitizePrompt.d.ts +15 -0
  198. package/dist/plus/agents/sanitizePrompt.d.ts.map +1 -0
  199. package/dist/plus/agents/sanitizePrompt.js +103 -0
  200. package/dist/plus/agents/sanitizePrompt.js.map +1 -0
  201. package/dist/plus/agents/stateMachine.d.ts +32 -0
  202. package/dist/plus/agents/stateMachine.d.ts.map +1 -0
  203. package/dist/plus/agents/stateMachine.js +180 -0
  204. package/dist/plus/agents/stateMachine.js.map +1 -0
  205. package/dist/plus/agents/types.d.ts +254 -0
  206. package/dist/plus/agents/types.d.ts.map +1 -0
  207. package/dist/plus/agents/types.js +49 -0
  208. package/dist/plus/agents/types.js.map +1 -0
  209. package/dist/plus/ai/errors.d.ts +4 -1
  210. package/dist/plus/ai/errors.d.ts.map +1 -1
  211. package/dist/plus/ai/errors.js +38 -0
  212. package/dist/plus/ai/errors.js.map +1 -1
  213. package/dist/plus/ai/models/model.d.ts +1 -1
  214. package/dist/plus/ai/models/model.d.ts.map +1 -1
  215. package/dist/plus/ai/models/model.js.map +1 -1
  216. package/dist/plus/ai/models/promptTemplates.d.ts +11 -2
  217. package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
  218. package/dist/plus/ai/models/provider.d.ts +3 -0
  219. package/dist/plus/ai/models/provider.d.ts.map +1 -1
  220. package/dist/plus/ai/prompts.d.ts +1 -0
  221. package/dist/plus/ai/prompts.d.ts.map +1 -1
  222. package/dist/plus/ai/prompts.js +48 -8
  223. package/dist/plus/ai/prompts.js.map +1 -1
  224. package/dist/plus/ai/providers/gitkrakenProvider.d.ts +1 -1
  225. package/dist/plus/ai/providers/gitkrakenProvider.d.ts.map +1 -1
  226. package/dist/plus/ai/providers/gitkrakenProvider.js +4 -1
  227. package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
  228. package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts +4 -3
  229. package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts.map +1 -1
  230. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +9 -6
  231. package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
  232. package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
  233. package/dist/plus/ai/utils/ai.utils.js +2 -0
  234. package/dist/plus/ai/utils/ai.utils.js.map +1 -1
  235. package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
  236. package/dist/plus/ai/utils/results.utils.js.map +1 -1
  237. package/dist/plus/git-github/api/github.d.ts +12 -1
  238. package/dist/plus/git-github/api/github.d.ts.map +1 -1
  239. package/dist/plus/git-github/api/github.js +245 -51
  240. package/dist/plus/git-github/api/github.js.map +1 -1
  241. package/dist/plus/git-github/api/types.d.ts +8 -0
  242. package/dist/plus/git-github/api/types.d.ts.map +1 -1
  243. package/dist/plus/git-github/models.d.ts +1 -1
  244. package/dist/plus/git-github/models.d.ts.map +1 -1
  245. package/dist/plus/git-github/models.js.map +1 -1
  246. package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
  247. package/dist/plus/git-github/providers/github/blame.js.map +1 -1
  248. package/dist/plus/git-github/providers/github/branches.d.ts +5 -1
  249. package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
  250. package/dist/plus/git-github/providers/github/branches.js +47 -24
  251. package/dist/plus/git-github/providers/github/branches.js.map +1 -1
  252. package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
  253. package/dist/plus/git-github/providers/github/commits.js +144 -92
  254. package/dist/plus/git-github/providers/github/commits.js.map +1 -1
  255. package/dist/plus/git-github/providers/github/diff.d.ts +1 -1
  256. package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
  257. package/dist/plus/git-github/providers/github/diff.js +23 -9
  258. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  259. package/dist/plus/git-github/providers/github/refs.d.ts +9 -1
  260. package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
  261. package/dist/plus/git-github/providers/github/refs.js +39 -14
  262. package/dist/plus/git-github/providers/github/refs.js.map +1 -1
  263. package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
  264. package/dist/plus/git-github/providers/github/revision.js +1 -2
  265. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  266. package/dist/plus/git-github/providers/github/status.d.ts +4 -1
  267. package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
  268. package/dist/plus/git-github/providers/github/status.js +1 -1
  269. package/dist/plus/git-github/providers/github/status.js.map +1 -1
  270. package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
  271. package/dist/plus/git-github/providers/github/tags.js +35 -36
  272. package/dist/plus/git-github/providers/github/tags.js.map +1 -1
  273. package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
  274. package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
  275. package/dist/utils/color.d.ts.map +1 -1
  276. package/dist/utils/color.js.map +1 -1
  277. package/dist/utils/date.d.ts.map +1 -1
  278. package/dist/utils/date.js +6 -0
  279. package/dist/utils/date.js.map +1 -1
  280. package/dist/utils/debounce.js +1 -1
  281. package/dist/utils/decorators/serializable.d.ts.map +1 -1
  282. package/dist/utils/decorators/serializable.js.map +1 -1
  283. package/dist/utils/dedupedAsyncCache.d.ts +37 -0
  284. package/dist/utils/dedupedAsyncCache.d.ts.map +1 -0
  285. package/dist/utils/dedupedAsyncCache.js +68 -0
  286. package/dist/utils/dedupedAsyncCache.js.map +1 -0
  287. package/dist/utils/diff.d.ts +2 -0
  288. package/dist/utils/diff.d.ts.map +1 -0
  289. package/dist/utils/diff.js +53 -0
  290. package/dist/utils/diff.js.map +1 -0
  291. package/dist/utils/disposable.d.ts.map +1 -1
  292. package/dist/utils/disposable.js.map +1 -1
  293. package/dist/utils/env/node/exec.d.ts.map +1 -1
  294. package/dist/utils/env/node/exec.js.map +1 -1
  295. package/dist/utils/error.d.ts.map +1 -1
  296. package/dist/utils/error.js.map +1 -1
  297. package/dist/utils/iterable.d.ts +7 -1
  298. package/dist/utils/iterable.d.ts.map +1 -1
  299. package/dist/utils/iterable.js +12 -4
  300. package/dist/utils/iterable.js.map +1 -1
  301. package/dist/utils/logger.d.ts.map +1 -1
  302. package/dist/utils/logger.js.map +1 -1
  303. package/dist/utils/lruMap.d.ts +9 -0
  304. package/dist/utils/lruMap.d.ts.map +1 -1
  305. package/dist/utils/lruMap.js +26 -4
  306. package/dist/utils/lruMap.js.map +1 -1
  307. package/dist/utils/markdown.d.ts.map +1 -1
  308. package/dist/utils/markdown.js.map +1 -1
  309. package/dist/utils/mru.d.ts.map +1 -1
  310. package/dist/utils/mru.js.map +1 -1
  311. package/dist/utils/object.d.ts +22 -1
  312. package/dist/utils/object.d.ts.map +1 -1
  313. package/dist/utils/object.js +56 -3
  314. package/dist/utils/object.js.map +1 -1
  315. package/dist/utils/paging.js +14 -15
  316. package/dist/utils/paging.js.map +1 -1
  317. package/dist/utils/path.d.ts.map +1 -1
  318. package/dist/utils/path.js.map +1 -1
  319. package/dist/utils/promise.d.ts +1 -0
  320. package/dist/utils/promise.d.ts.map +1 -1
  321. package/dist/utils/promise.js +17 -0
  322. package/dist/utils/promise.js.map +1 -1
  323. package/dist/utils/promiseCache.d.ts +10 -0
  324. package/dist/utils/promiseCache.d.ts.map +1 -1
  325. package/dist/utils/promiseCache.js +34 -4
  326. package/dist/utils/promiseCache.js.map +1 -1
  327. package/dist/utils/string.d.ts.map +1 -1
  328. package/dist/utils/string.js +1 -1
  329. package/dist/utils/string.js.map +1 -1
  330. package/dist/utils/uri.d.ts.map +1 -1
  331. package/dist/utils/uri.js.map +1 -1
  332. package/dist/utils/version.d.ts.map +1 -1
  333. package/dist/utils/version.js.map +1 -1
  334. package/package.json +13 -1
  335. package/src/git/cache.ts +192 -90
  336. package/src/git/context.ts +21 -0
  337. package/src/git/features.ts +2 -0
  338. package/src/git/models/commit.ts +1 -0
  339. package/src/git/models/graph.ts +97 -0
  340. package/src/git/models/reference.ts +33 -0
  341. package/src/git/models/remote.ts +1 -0
  342. package/src/git/models/remoteProvider.ts +1 -0
  343. package/src/git/models/repository.ts +105 -96
  344. package/src/git/models/search.ts +2 -2
  345. package/src/git/models/statusFile.ts +12 -0
  346. package/src/git/models/worktree.ts +10 -2
  347. package/src/git/parsers/diffParser.ts +2 -0
  348. package/src/git/providers/branches.ts +22 -4
  349. package/src/git/providers/commits.ts +4 -0
  350. package/src/git/providers/config.ts +3 -5
  351. package/src/git/providers/operations.ts +65 -1
  352. package/src/git/providers/pausedOperations.ts +1 -0
  353. package/src/git/providers/refs.ts +32 -3
  354. package/src/git/providers/staging.ts +12 -0
  355. package/src/git/providers/status.ts +6 -1
  356. package/src/git/remotes/azure-devops.ts +2 -0
  357. package/src/git/remotes/custom.ts +23 -0
  358. package/src/git/{exec.types.ts → run.types.ts} +22 -2
  359. package/src/git/service.ts +1 -0
  360. package/src/git/utils/autolink.utils.ts +1 -0
  361. package/src/git/utils/blame.utils.ts +2 -0
  362. package/src/git/utils/conflictResolution.utils.ts +31 -0
  363. package/src/git/utils/contributor.utils.ts +24 -0
  364. package/src/git/utils/fileStatus.utils.ts +7 -1
  365. package/src/git/utils/reachability.utils.ts +109 -0
  366. package/src/git/utils/search.utils.ts +2 -0
  367. package/src/git/utils/sorting.ts +17 -0
  368. package/src/git/utils/status.utils.ts +1 -0
  369. package/src/git/watching/classifyChange.ts +9 -0
  370. package/src/git/watching/gitIgnoreFilter.ts +2 -2
  371. package/src/git/watching/initWatcher.ts +2 -0
  372. package/src/git/watching/watchGroup.ts +3 -0
  373. package/src/git/watching/watchService.ts +45 -7
  374. package/src/git/watching/watchSession.ts +71 -55
  375. package/src/git-cli/exec/exec.types.ts +2 -2
  376. package/src/git-cli/exec/git.ts +6 -5
  377. package/src/git-cli/exec/gitQueue.ts +41 -12
  378. package/src/git-cli/parsers/blameParser.ts +1 -0
  379. package/src/git-cli/parsers/logParser.ts +1 -0
  380. package/src/git-cli/parsers/refParser.ts +33 -34
  381. package/src/git-cli/providers/blame.ts +1 -0
  382. package/src/git-cli/providers/branches.ts +165 -93
  383. package/src/git-cli/providers/commits.ts +107 -37
  384. package/src/git-cli/providers/config.ts +101 -48
  385. package/src/git-cli/providers/diff.ts +10 -3
  386. package/src/git-cli/providers/graph.ts +156 -16
  387. package/src/git-cli/providers/operations.ts +208 -83
  388. package/src/git-cli/providers/patch.ts +1 -0
  389. package/src/git-cli/providers/pausedOperations.ts +8 -0
  390. package/src/git-cli/providers/refs.ts +247 -3
  391. package/src/git-cli/providers/revision.ts +2 -2
  392. package/src/git-cli/providers/staging.ts +33 -0
  393. package/src/git-cli/providers/stash.ts +20 -2
  394. package/src/git-cli/providers/status.ts +24 -5
  395. package/src/git-cli/providers/tags.ts +15 -16
  396. package/src/ipc/discovery.ts +186 -0
  397. package/src/ipc/ipcServer.ts +171 -0
  398. package/src/plus/agents/providers/claudeCodeProvider.ts +2122 -0
  399. package/src/plus/agents/providers/claudeCodeTranscript.ts +214 -0
  400. package/src/plus/agents/sanitizePrompt.ts +109 -0
  401. package/src/plus/agents/stateMachine.ts +197 -0
  402. package/src/plus/agents/types.ts +325 -0
  403. package/src/plus/ai/errors.ts +40 -0
  404. package/src/plus/ai/models/model.ts +1 -0
  405. package/src/plus/ai/models/promptTemplates.ts +13 -0
  406. package/src/plus/ai/models/provider.ts +7 -1
  407. package/src/plus/ai/prompts.ts +49 -8
  408. package/src/plus/ai/providers/gitkrakenProvider.ts +4 -0
  409. package/src/plus/ai/providers/openAICompatibleProviderBase.ts +21 -4
  410. package/src/plus/ai/utils/ai.utils.ts +2 -0
  411. package/src/plus/ai/utils/results.utils.ts +2 -0
  412. package/src/plus/git-github/api/github.ts +315 -57
  413. package/src/plus/git-github/api/types.ts +15 -0
  414. package/src/plus/git-github/models.ts +1 -1
  415. package/src/plus/git-github/providers/github/blame.ts +2 -0
  416. package/src/plus/git-github/providers/github/branches.ts +61 -31
  417. package/src/plus/git-github/providers/github/commits.ts +231 -160
  418. package/src/plus/git-github/providers/github/diff.ts +27 -19
  419. package/src/plus/git-github/providers/github/refs.ts +58 -23
  420. package/src/plus/git-github/providers/github/revision.ts +1 -2
  421. package/src/plus/git-github/providers/github/status.ts +6 -1
  422. package/src/plus/git-github/providers/github/tags.ts +61 -62
  423. package/src/plus/git-github/providers/githubGitProvider.ts +1 -0
  424. package/src/utils/color.ts +2 -0
  425. package/src/utils/date.ts +5 -0
  426. package/src/utils/debounce.ts +1 -1
  427. package/src/utils/decorators/serializable.ts +1 -0
  428. package/src/utils/dedupedAsyncCache.ts +74 -0
  429. package/src/utils/diff.ts +61 -0
  430. package/src/utils/disposable.ts +2 -0
  431. package/src/utils/env/node/exec.ts +2 -0
  432. package/src/utils/error.ts +1 -0
  433. package/src/utils/iterable.ts +17 -3
  434. package/src/utils/logger.ts +1 -0
  435. package/src/utils/lruMap.ts +29 -4
  436. package/src/utils/markdown.ts +1 -0
  437. package/src/utils/mru.ts +2 -0
  438. package/src/utils/object.ts +55 -4
  439. package/src/utils/paging.ts +14 -14
  440. package/src/utils/path.ts +1 -0
  441. package/src/utils/promise.ts +22 -0
  442. package/src/utils/promiseCache.ts +48 -16
  443. package/src/utils/string.ts +3 -1
  444. package/src/utils/uri.ts +1 -0
  445. package/src/utils/version.ts +1 -0
  446. package/dist/git/exec.types.d.ts.map +0 -1
  447. package/dist/git/exec.types.js +0 -2
  448. package/dist/git/exec.types.js.map +0 -1
@@ -1,52 +1,51 @@
1
1
  import type { FilteredGitFeatures } from '../../git/features.js';
2
+ import type { RefRecord } from '../../git/models/reference.js';
2
3
  import { maybeStopWatch } from '../../utils/stopwatch.js';
3
4
  import { iterateByDelimiter } from '../../utils/string.js';
4
5
  import type { ExtractAll } from '../../utils/types.js';
5
6
  import type { Parser } from './logParser.js';
6
7
 
7
- const branchMapping = {
8
- current: `%(HEAD)`, // HEAD indicator (current branch)
9
- name: `%(refname)`, // Full reference name
10
- upstream: `%(upstream)`, // Upstream branch, if any
11
- upstreamTracking: `%(upstream:track)`, // Tracking status
12
- sha: `%(objectname)`, // SHA
13
- date: `%(committerdate:iso8601)`, // Date
8
+ /**
9
+ * Unified `for-each-ref` mapping covering branches, remotes, and tags in a single pass.
10
+ * Fields inapplicable to a given ref-type come back as empty strings from git.
11
+ *
12
+ * NOTE: When adding a new field that is gated on a git feature flag, mirror the entry in
13
+ * `refMappingSupportsWorktreePath` (and any future variants) both maps MUST stay aligned
14
+ * so callers can switch parsers based on `git.supported('git:for-each-ref')` without losing
15
+ * field positions.
16
+ */
17
+ const refMapping = {
18
+ current: `%(HEAD)`,
19
+ name: `%(refname)`,
20
+ objectname: `%(objectname)`,
21
+ peeledObjectname: `%(*objectname)`,
22
+ upstream: `%(upstream)`,
23
+ upstreamTracking: `%(upstream:track)`,
24
+ committerDate: `%(committerdate:iso8601)`,
25
+ creatorDate: `%(creatordate:iso8601)`,
26
+ authorDate: `%(authordate:iso8601)`,
27
+ subject: `%(subject)`,
14
28
  worktreePath: undefined,
15
29
  };
16
30
 
17
- const branchMappingSupportsWorktreePath = {
18
- ...branchMapping,
19
- worktreePath: '%(worktreepath)', // Worktree path
31
+ const refMappingSupportsWorktreePath = {
32
+ ...refMapping,
33
+ worktreePath: '%(worktreepath)',
20
34
  };
21
35
 
22
- type BranchParser = Parser<typeof branchMapping> | Parser<typeof branchMappingSupportsWorktreePath>;
36
+ type RefParser = Parser<RefRecord>;
23
37
 
24
- let _branchParser: BranchParser | undefined;
25
- let _branchParserWithWorktree: BranchParser | undefined;
26
- export function getBranchParser(supportedFeatures: FilteredGitFeatures<'git:for-each-ref'>[]): BranchParser {
38
+ let _refParser: RefParser | undefined;
39
+ let _refParserWithWorktree: RefParser | undefined;
40
+
41
+ export function getRefParser(supportedFeatures: FilteredGitFeatures<'git:for-each-ref'>[]): RefParser {
27
42
  if (supportedFeatures.includes('git:for-each-ref:worktreePath')) {
28
- _branchParserWithWorktree ??= createRefParser(branchMappingSupportsWorktreePath);
29
- return _branchParserWithWorktree;
43
+ _refParserWithWorktree ??= createRefParser(refMappingSupportsWorktreePath);
44
+ return _refParserWithWorktree;
30
45
  }
31
- _branchParser ??= createRefParser(branchMapping);
32
- return _branchParser;
33
- }
34
-
35
- const tagMapping = {
36
- name: `%(refname)`, // Full reference name
37
- tagSha: `%(objectname)`, // sha of the tag
38
- sha: `%(*objectname)`, // sha of the commit the tag points to, if any
39
- date: `%(creatordate:iso8601)`, // date the tag was created
40
- commitDate: `%(authordate:iso8601)`, // author date of the commit the tag points to
41
- message: `%(subject)`, // message
42
- };
43
-
44
- type TagParser = Parser<typeof tagMapping>;
45
- let _tagParser: TagParser | undefined;
46
46
 
47
- export function getTagParser(): TagParser {
48
- _tagParser ??= createRefParser(tagMapping);
49
- return _tagParser;
47
+ _refParser ??= createRefParser(refMapping);
48
+ return _refParser;
50
49
  }
51
50
 
52
51
  const recordSep = '\x1E'; // ASCII Record Separator character
@@ -234,6 +234,7 @@ export class BlameGitSubProvider implements GitBlameSubProvider {
234
234
  let blameLine = blame.lines[editorLine];
235
235
  if (blameLine == null) {
236
236
  if (blame.lines.length !== editorLine) return undefined;
237
+
237
238
  blameLine = blame.lines[editorLine - 1];
238
239
  }
239
240
 
@@ -1,4 +1,4 @@
1
- import type { Cache, ConflictDetectionCacheKey } from '../../git/cache.js';
1
+ import type { Cache, ConflictDetectionCacheKey, GkConfigInvalidationTarget } from '../../git/cache.js';
2
2
  import type { GitServiceContext } from '../../git/context.js';
3
3
  import { BranchError } from '../../git/errors.js';
4
4
  import type { BranchDisposition, BranchMetadata } from '../../git/models/branch.js';
@@ -10,6 +10,7 @@ import type {
10
10
  GitBranchesSubProvider,
11
11
  GitBranchMergedStatus,
12
12
  } from '../../git/providers/branches.js';
13
+ import type { GitCommandPriority } from '../../git/run.types.js';
13
14
  import {
14
15
  formatDetachedHeadName,
15
16
  getBranchId,
@@ -41,7 +42,6 @@ import type { GitResult } from '../exec/exec.types.js';
41
42
  import type { Git } from '../exec/git.js';
42
43
  import { getGitCommandError, gitConfigsBranch, gitConfigsLog, GitError, GitErrors, GitWarnings } from '../exec/git.js';
43
44
  import { parseMergeTreeConflict } from '../parsers/mergeTreeParser.js';
44
- import { getBranchParser } from '../parsers/refParser.js';
45
45
 
46
46
  /** Minimum time between writes to the config for last accessed/modified dates */
47
47
  const dateMetadataStaleThresholdMs = 5 * 60 * 1000; // 5 minutes
@@ -96,7 +96,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
96
96
  const [pausedOpStatusResult, committerDateResult, defaultWorktreePathResult, metadataMapResult] =
97
97
  await Promise.allSettled([
98
98
  isDetachedHead(ref.name)
99
- ? this.provider.pausedOps?.getPausedOperationStatus(repoPath, cancellation)
99
+ ? this.provider.pausedOps?.getPausedOperationStatus(repoPath, undefined, cancellation)
100
100
  : undefined,
101
101
  this.git
102
102
  .run(
@@ -168,27 +168,22 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
168
168
  // own cancellation when bypassing the cache (e.g. paging-cursor path).
169
169
  signal ??= cancellation;
170
170
  try {
171
- const supported = await this.git.supported('git:for-each-ref');
172
- const parser = getBranchParser(supported);
173
-
174
- const [gitResult, defaultWorktreePathResult, metadataMapResult] = await Promise.allSettled([
175
- this.git.run(
176
- { cwd: commonPath, cancellation: signal },
177
- 'for-each-ref',
178
- ...parser.arguments,
179
- 'refs/heads/',
180
- 'refs/remotes/',
181
- ),
182
- this.provider.config.getDefaultWorktreePath?.(commonPath),
183
- this.getBranchMetadataMap(commonPath),
184
- ]);
185
-
186
- const result = getSettledValue(gitResult);
171
+ const [recordsResult, supportedResult, defaultWorktreePathResult, metadataMapResult] =
172
+ await Promise.allSettled([
173
+ this.provider.refs.getRefs(commonPath, signal),
174
+ this.git.supported('git:for-each-ref'),
175
+ this.provider.config.getDefaultWorktreePath?.(commonPath),
176
+ this.getBranchMetadataMap(commonPath),
177
+ ]);
178
+
179
+ const records = getSettledValue(recordsResult) ?? [];
180
+ const supported = getSettledValue(supportedResult) ?? [];
187
181
  const metadataMap = getSettledValue(metadataMapResult) ?? new Map<string, BranchMetadata>();
188
182
  const defaultWorktreePath = getSettledValue(defaultWorktreePathResult);
183
+ const worktreePathSupported = supported.includes('git:for-each-ref:worktreePath');
189
184
 
190
185
  // If we don't get any data, assume the repo doesn't have any commits yet so check if we have a current branch
191
- if (!result?.stdout) {
186
+ if (!records.length) {
192
187
  const current = await this.getCurrentBranch(
193
188
  commonPath,
194
189
  metadataMap,
@@ -202,25 +197,28 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
202
197
 
203
198
  const branches: GitBranch[] = [];
204
199
 
205
- for (const entry of parser.parse(result.stdout)) {
200
+ for (const record of records) {
201
+ const fullName = record.name;
202
+ // Filter to branches and remote-tracking branches; skip tags from the unified records.
203
+ if (!fullName.startsWith('refs/heads/') && !fullName.startsWith('refs/remotes/')) continue;
206
204
  // Skip HEAD refs in remote branches
207
- if (isRemoteHEAD(entry.name)) continue;
205
+ if (isRemoteHEAD(fullName)) continue;
208
206
 
209
- const upstream = parseUpstream(entry.upstream, entry.upstreamTracking);
207
+ const upstream = parseUpstream(record.upstream, record.upstreamTracking);
210
208
 
211
- const metadata = metadataMap.get(parseRefName(entry.name).name);
212
- const worktreePath = entry.worktreePath ? normalizePath(entry.worktreePath) : undefined;
209
+ const metadata = metadataMap.get(parseRefName(fullName).name);
210
+ const worktreePath = record.worktreePath ? normalizePath(record.worktreePath) : undefined;
213
211
 
214
212
  branches.push(
215
213
  new GitBranch(
216
214
  commonPath,
217
- entry.name,
215
+ fullName,
218
216
  false, // Don't trust %(HEAD) for current as it's per-worktree -- we will set it later
219
- entry.date ? new Date(entry.date) : undefined,
217
+ record.committerDate ? new Date(record.committerDate) : undefined,
220
218
  metadata,
221
- entry.sha,
219
+ record.objectname,
222
220
  upstream,
223
- supported.includes('git:for-each-ref:worktreePath')
221
+ worktreePathSupported
224
222
  ? worktreePath
225
223
  ? { path: worktreePath, isDefault: worktreePath === defaultWorktreePath }
226
224
  : false
@@ -234,6 +232,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
234
232
  // Pre-populate current branch cache for worktrees based on worktreePath info
235
233
  // This eliminates the need for rev-parse calls during branch reconstruction
236
234
  for (const branch of branches) {
235
+ // oxlint-disable-next-line typescript/prefer-optional-chain
237
236
  if (branch.worktree && branch.worktree.path) {
238
237
  const { name } = parseRefName(branch.refName);
239
238
  const reference = createReference(name, branch.worktree.path, {
@@ -360,46 +359,23 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
360
359
  async getBranchContributionsOverview(
361
360
  repoPath: string,
362
361
  ref: string,
363
- options?: { associatedPullRequest?: Promise<{ refs?: { base?: { branch: string } } } | undefined> },
362
+ options?: {
363
+ associatedPullRequest?: Promise<{ refs?: { base?: { branch: string } } } | undefined>;
364
+ priority?: GitCommandPriority;
365
+ },
364
366
  cancellation?: AbortSignal,
365
367
  ): Promise<BranchContributionsOverview | undefined> {
366
368
  const scope = getScopedLogger();
369
+ const priority = options?.priority;
370
+ const priorityOpts = priority != null ? { priority: priority } : undefined;
367
371
 
368
- const getCore = async (
369
- _commonPath: string,
370
- _cacheable: CacheController | undefined,
372
+ // Expensive body runs only on cache miss. Closes over `mergeTarget` so the cache key
373
+ // (`${ref}|${mergeTarget}`) fully captures every input that affects the result.
374
+ const fetchBody = async (
375
+ mergeTarget: string,
371
376
  signal: AbortSignal | undefined,
372
- storedTarget: string | undefined,
373
377
  ): Promise<BranchContributionsOverview | undefined> => {
374
- let mergeTarget: string | undefined;
375
-
376
- // Tier 1: Stored merge target (user-set or previously detected from PR). Caller has
377
- // already read this once for the cache decision; reuse rather than re-fetching.
378
- if (storedTarget) {
379
- const validated = await this.provider.refs.getSymbolicReferenceName(repoPath, storedTarget);
380
- mergeTarget = validated || storedTarget;
381
- }
382
-
383
- // Tier 2: PR-based lookup. The branch object is only needed here (for `remoteName`),
384
- // so lazy-load it on the cold path instead of paying for it on every call.
385
- if (mergeTarget == null && options?.associatedPullRequest != null) {
386
- const pr = await options.associatedPullRequest;
387
- if (pr?.refs?.base != null) {
388
- const branch = await this.getBranch(repoPath, ref, signal);
389
- if (branch == null) return undefined;
390
- mergeTarget = `${branch.remoteName}/${pr.refs.base.branch}`;
391
- // Store for future reuse — turns the next call into a Tier 1 cache-eligible path.
392
- void this.storeMergeTargetBranchName(repoPath, ref, mergeTarget);
393
- }
394
- }
395
-
396
- // Tier 3: Base branch, then default branch
397
- mergeTarget ??= await this.getBaseBranchName(repoPath, ref, signal);
398
- mergeTarget ??= await this.getDefaultBranchName(repoPath, undefined, signal);
399
-
400
- if (mergeTarget == null) return undefined;
401
-
402
- const mergeBase = await this.provider.refs.getMergeBase(repoPath, ref, mergeTarget, undefined, signal);
378
+ const mergeBase = await this.provider.refs.getMergeBase(repoPath, ref, mergeTarget, priorityOpts, signal);
403
379
  if (mergeBase == null) return undefined;
404
380
 
405
381
  // Fetch the merge-base commit's dates in parallel with contributors so consumers
@@ -471,20 +447,61 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
471
447
  };
472
448
 
473
449
  try {
474
- // Pre-check Tier 1: when a stored merge target exists the result is deterministic for
475
- // `ref` (Tier 2's PR resolution is short-circuited), so it's safe to cache. Otherwise
476
- // the result depends on PR resolution which the cache key can't capture bypass.
450
+ // Resolve `mergeTarget` through Tier 1 Tier 2 Tier 3. The pieces of each tier are
451
+ // already individually cached (`getStoredMergeTargetBranchName`, `getBaseBranchName`,
452
+ // `getDefaultBranchName`), so this resolution path is cheap on warm caches. Only the
453
+ // expensive body below (`getMergeBase` + `getContributors` w/ stats + `getCommitDates`)
454
+ // is wrapped by `cache.getBranchOverview`, keyed on the resolved `mergeTarget` so any
455
+ // caller that resolves to the same target shares; differing targets get independent
456
+ // slots, which is the correctness constraint that previously forced the Tier 2/3 paths
457
+ // to bypass the cache entirely.
458
+ let mergeTarget: string | undefined;
459
+
460
+ // Tier 1: Stored merge target (user-set or previously detected from PR).
477
461
  const storedTarget = await this.getStoredMergeTargetBranchName(repoPath, ref);
478
- if (storedTarget != null) {
479
- return await this.cache.getBranchOverview(
462
+ if (storedTarget) {
463
+ const validated = await this.provider.refs.getSymbolicReferenceName(
480
464
  repoPath,
481
- ref,
482
- (commonPath, cacheable, signal) =>
483
- getCore(commonPath, cacheable, signal ?? cancellation, storedTarget),
484
- { cancellation: cancellation },
465
+ storedTarget,
466
+ priorityOpts,
467
+ cancellation,
485
468
  );
469
+ mergeTarget = validated || storedTarget;
470
+ }
471
+
472
+ // Tier 2: PR-based lookup. The branch object is only needed here (for `remoteName`),
473
+ // so lazy-load it on the cold path instead of paying for it on every call.
474
+ if (mergeTarget == null && options?.associatedPullRequest != null) {
475
+ const pr = await options.associatedPullRequest;
476
+ if (pr?.refs?.base != null) {
477
+ const branch = await this.getBranch(repoPath, ref, cancellation);
478
+ if (branch == null) return undefined;
479
+
480
+ mergeTarget = `${branch.remoteName}/${pr.refs.base.branch}`;
481
+ // Store for future reuse — turns the next call into a Tier 1 path. Skip the
482
+ // `branchOverviews` invalidation that the write would otherwise trigger: we're
483
+ // about to populate `${ref}|${mergeTarget}` with this exact target, so evicting
484
+ // it would just force the next caller to redo the body. (gk-merge-target writes
485
+ // do not affect `baseBranchName`, so no need to skip that target.)
486
+ void this.storeMergeTargetBranchName(repoPath, ref, mergeTarget, {
487
+ skipInvalidation: ['branchOverviews'],
488
+ });
489
+ }
486
490
  }
487
- return await getCore(repoPath, undefined, cancellation, undefined);
491
+
492
+ // Tier 3: Base branch, then default branch.
493
+ mergeTarget ??= await this.getBaseBranchName(repoPath, ref, priorityOpts, cancellation);
494
+ mergeTarget ??= await this.getDefaultBranchName(repoPath, undefined, priorityOpts, cancellation);
495
+
496
+ if (mergeTarget == null) return undefined;
497
+
498
+ const resolvedTarget = mergeTarget;
499
+ return await this.cache.getBranchOverview(
500
+ repoPath,
501
+ `${ref}|${resolvedTarget}`,
502
+ (_commonPath, _cacheable, signal) => fetchBody(resolvedTarget, signal ?? cancellation),
503
+ { cancellation: cancellation },
504
+ );
488
505
  } catch (ex) {
489
506
  scope?.error(ex);
490
507
  if (isCancellationError(ex)) throw ex;
@@ -624,7 +641,12 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
624
641
  }
625
642
 
626
643
  if (data == null) {
627
- const symbolicRef = await this.getDefaultBranchName(repoPath, 'origin', signal);
644
+ const symbolicRef = await this.getDefaultBranchName(
645
+ repoPath,
646
+ 'origin',
647
+ undefined,
648
+ signal,
649
+ );
628
650
  if (symbolicRef != null) {
629
651
  data = [
630
652
  symbolicRef.startsWith('origin/')
@@ -705,18 +727,21 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
705
727
  async getDefaultBranchName(
706
728
  repoPath: string | undefined,
707
729
  remote?: string,
730
+ options?: { priority?: GitCommandPriority },
708
731
  cancellation?: AbortSignal,
709
732
  ): Promise<string | undefined> {
710
733
  if (repoPath == null) return undefined;
711
734
 
712
735
  remote ??= 'origin';
736
+ const priority = options?.priority;
737
+ const priorityOpts = priority != null ? { priority: priority } : undefined;
713
738
 
714
739
  return this.cache.getDefaultBranchName(repoPath, remote, async commonPath => {
715
740
  let retried = false;
716
741
  while (true) {
717
742
  try {
718
743
  const result = await this.git.run(
719
- { cwd: commonPath, cancellation: cancellation },
744
+ { cwd: commonPath, cancellation: cancellation, ...priorityOpts },
720
745
  'symbolic-ref',
721
746
  '--short',
722
747
  `refs/remotes/${remote}/HEAD`,
@@ -728,7 +753,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
728
753
  if (!retried) {
729
754
  retried = true;
730
755
  await this.git.run(
731
- { cwd: commonPath, cancellation: cancellation },
756
+ { cwd: commonPath, cancellation: cancellation, ...priorityOpts },
732
757
  'remote',
733
758
  'set-head',
734
759
  '-a',
@@ -738,7 +763,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
738
763
  }
739
764
 
740
765
  const result = await this.git.run(
741
- { cwd: commonPath, cancellation: cancellation },
766
+ { cwd: commonPath, cancellation: cancellation, ...priorityOpts },
742
767
  'ls-remote',
743
768
  '--symref',
744
769
  remote,
@@ -1156,6 +1181,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
1156
1181
  currentTreeOid = treeResult.stdout.trim();
1157
1182
  } catch (ex) {
1158
1183
  if (isCancellationError(ex)) throw ex;
1184
+
1159
1185
  scope?.error(ex, `Failed to resolve target branch '${targetBranch}'`);
1160
1186
  return createConflictDetectionError('refNotFound');
1161
1187
  }
@@ -1263,7 +1289,15 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
1263
1289
  }
1264
1290
 
1265
1291
  @debug({ exit: true })
1266
- getBaseBranchName(repoPath: string, ref: string, cancellation?: AbortSignal): Promise<string | undefined> {
1292
+ getBaseBranchName(
1293
+ repoPath: string,
1294
+ ref: string,
1295
+ options?: { priority?: GitCommandPriority },
1296
+ cancellation?: AbortSignal,
1297
+ ): Promise<string | undefined> {
1298
+ const priority = options?.priority;
1299
+ const priorityOpts = priority != null ? { priority: priority } : undefined;
1300
+
1267
1301
  return this.cache.getBaseBranchName(
1268
1302
  repoPath,
1269
1303
  ref,
@@ -1280,19 +1314,36 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
1280
1314
  }
1281
1315
 
1282
1316
  if (mergeBase != null) {
1283
- const branch = await this.provider.refs.getSymbolicReferenceName(commonPath, mergeBase);
1317
+ const branch = await this.provider.refs.getSymbolicReferenceName(
1318
+ commonPath,
1319
+ mergeBase,
1320
+ priorityOpts,
1321
+ );
1284
1322
  if (branch != null) {
1285
1323
  if (update) {
1286
- void this.storeBaseBranchName(commonPath, ref, branch);
1324
+ // Self-write: the value we're storing is exactly what this factory is
1325
+ // returning, so any in-flight `branchOverviews` or `baseBranchName` entry
1326
+ // being populated against this resolution should NOT be evicted.
1327
+ void this.storeBaseBranchName(commonPath, ref, branch, {
1328
+ skipInvalidation: ['branchOverviews', 'baseBranchName'],
1329
+ });
1287
1330
  }
1288
1331
  return branch;
1289
1332
  }
1290
1333
  }
1291
1334
  } catch {}
1292
1335
 
1293
- const branch = await this.getBaseBranchFromReflog(commonPath, ref, { upstream: true }, signal);
1336
+ const branch = await this.getBaseBranchFromReflog(
1337
+ commonPath,
1338
+ ref,
1339
+ { upstream: true, priority: priority },
1340
+ signal,
1341
+ );
1294
1342
  if (branch != null) {
1295
- void this.storeBaseBranchName(commonPath, ref, branch);
1343
+ // Self-write: see comment on the migration path above.
1344
+ void this.storeBaseBranchName(commonPath, ref, branch, {
1345
+ skipInvalidation: ['branchOverviews', 'baseBranchName'],
1346
+ });
1296
1347
  return branch;
1297
1348
  }
1298
1349
 
@@ -1305,12 +1356,15 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
1305
1356
  private async getBaseBranchFromReflog(
1306
1357
  repoPath: string,
1307
1358
  ref: string,
1308
- options?: { upstream: true },
1359
+ options?: { upstream: true; priority?: GitCommandPriority },
1309
1360
  cancellation?: AbortSignal,
1310
1361
  ): Promise<string | undefined> {
1362
+ const priority = options?.priority;
1363
+ const priorityOpts = priority != null ? { priority: priority } : undefined;
1364
+
1311
1365
  try {
1312
1366
  let result = await this.git.run(
1313
- { cwd: repoPath, cancellation: cancellation },
1367
+ { cwd: repoPath, cancellation: cancellation, ...priorityOpts },
1314
1368
  'reflog',
1315
1369
  ref,
1316
1370
  '--grep-reflog=branch: Created from *.',
@@ -1325,18 +1379,22 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
1325
1379
  let name: string | undefined = match[1];
1326
1380
  if (name !== 'HEAD') {
1327
1381
  if (options?.upstream) {
1328
- const upstream = await this.provider.refs.getSymbolicReferenceName(repoPath, `${name}@{u}`);
1382
+ const upstream = await this.provider.refs.getSymbolicReferenceName(
1383
+ repoPath,
1384
+ `${name}@{u}`,
1385
+ priorityOpts,
1386
+ );
1329
1387
  if (upstream) return upstream;
1330
1388
  }
1331
1389
 
1332
- name = await this.provider.refs.getSymbolicReferenceName(repoPath, name);
1390
+ name = await this.provider.refs.getSymbolicReferenceName(repoPath, name, priorityOpts);
1333
1391
  if (name) return name;
1334
1392
  }
1335
1393
  }
1336
1394
 
1337
1395
  // Check if branch was created from HEAD
1338
1396
  result = await this.git.run(
1339
- { cwd: repoPath, cancellation: cancellation },
1397
+ { cwd: repoPath, cancellation: cancellation, ...priorityOpts },
1340
1398
  'reflog',
1341
1399
  'HEAD',
1342
1400
  `--grep-reflog=checkout: moving from .* to ${ref.replace('refs/heads/', '')}`,
@@ -1349,11 +1407,15 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
1349
1407
  if (match?.length === 2) {
1350
1408
  let name: string | undefined = match[1];
1351
1409
  if (options?.upstream) {
1352
- const upstream = await this.provider.refs.getSymbolicReferenceName(repoPath, `${name}@{u}`);
1410
+ const upstream = await this.provider.refs.getSymbolicReferenceName(
1411
+ repoPath,
1412
+ `${name}@{u}`,
1413
+ priorityOpts,
1414
+ );
1353
1415
  if (upstream) return upstream;
1354
1416
  }
1355
1417
 
1356
- name = await this.provider.refs.getSymbolicReferenceName(repoPath, name);
1418
+ name = await this.provider.refs.getSymbolicReferenceName(repoPath, name, priorityOpts);
1357
1419
  if (name) return name;
1358
1420
  }
1359
1421
  } catch (ex) {
@@ -1469,13 +1531,23 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
1469
1531
  }
1470
1532
 
1471
1533
  @debug()
1472
- async storeBaseBranchName(repoPath: string, ref: string, base: string): Promise<void> {
1473
- await this.provider.config.setGkConfig(repoPath, `branch.${ref}.gk-merge-base`, base);
1534
+ async storeBaseBranchName(
1535
+ repoPath: string,
1536
+ ref: string,
1537
+ base: string,
1538
+ options?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },
1539
+ ): Promise<void> {
1540
+ await this.provider.config.setGkConfig(repoPath, `branch.${ref}.gk-merge-base`, base, options);
1474
1541
  }
1475
1542
 
1476
1543
  @debug()
1477
- async storeMergeTargetBranchName(repoPath: string, ref: string, target: string): Promise<void> {
1478
- await this.provider.config.setGkConfig(repoPath, `branch.${ref}.gk-merge-target`, target);
1544
+ async storeMergeTargetBranchName(
1545
+ repoPath: string,
1546
+ ref: string,
1547
+ target: string,
1548
+ options?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },
1549
+ ): Promise<void> {
1550
+ await this.provider.config.setGkConfig(repoPath, `branch.${ref}.gk-merge-target`, target, options);
1479
1551
  }
1480
1552
 
1481
1553
  @debug()