@gitkraken/core-gitlens 0.45.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/dist/git/models/remote.js +2 -2
  3. package/dist/git/models/remote.js.map +1 -1
  4. package/dist/git/remotes/matcher.js +25 -3
  5. package/dist/git/remotes/matcher.js.map +1 -1
  6. package/dist/git/utils/branchLanded.utils.d.ts +7 -0
  7. package/dist/git/utils/branchLanded.utils.js +10 -1
  8. package/dist/git/utils/branchLanded.utils.js.map +1 -1
  9. package/dist/git/utils/remote.utils.d.ts +1 -0
  10. package/dist/git/utils/remote.utils.js +14 -5
  11. package/dist/git/utils/remote.utils.js.map +1 -1
  12. package/dist/git-cli/parsers/logParser.js +227 -468
  13. package/dist/git-cli/parsers/logParser.js.map +1 -1
  14. package/dist/git-cli/parsers/refParser.js +4 -4
  15. package/dist/git-cli/parsers/refParser.js.map +1 -1
  16. package/dist/git-cli/providers/branches.d.ts +5 -0
  17. package/dist/git-cli/providers/branches.js +25 -21
  18. package/dist/git-cli/providers/branches.js.map +1 -1
  19. package/dist/git-cli/providers/config.js +2 -2
  20. package/dist/git-cli/providers/pausedOperations.js +2 -2
  21. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  22. package/dist/git-cli/providers/staging.js +1 -1
  23. package/dist/ipc/discovery.js +1 -1
  24. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  25. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  26. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  27. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.d.ts +31 -0
  28. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js +166 -0
  29. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js.map +1 -0
  30. package/dist/plus/git-github/api/github.d.ts +13 -5
  31. package/dist/plus/git-github/api/github.js +53 -13
  32. package/dist/plus/git-github/api/github.js.map +1 -1
  33. package/dist/plus/git-github/api/issueWrites.d.ts +7 -1
  34. package/dist/plus/git-github/api/issueWrites.js +62 -32
  35. package/dist/plus/git-github/api/issueWrites.js.map +1 -1
  36. package/dist/plus/git-github/api/pullRequestWrites.d.ts +7 -3
  37. package/dist/plus/git-github/api/pullRequestWrites.js +120 -67
  38. package/dist/plus/git-github/api/pullRequestWrites.js.map +1 -1
  39. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +44 -0
  40. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +199 -0
  41. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -0
  42. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
  43. package/dist/plus/integrations/authentication/configuredIntegrationService.js +53 -7
  44. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  45. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +2 -38
  46. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +0 -199
  47. package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +4 -2
  48. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +12 -1
  49. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  50. package/dist/plus/integrations/authentication/models.d.ts +0 -1
  51. package/dist/plus/integrations/authentication/models.js +1 -2
  52. package/dist/plus/integrations/authentication/models.js.map +1 -1
  53. package/dist/plus/integrations/constants.d.ts +0 -10
  54. package/dist/plus/integrations/constants.js +1 -95
  55. package/dist/plus/integrations/constants.js.map +1 -1
  56. package/dist/plus/integrations/context.d.ts +17 -17
  57. package/dist/plus/integrations/index.d.ts +44 -25
  58. package/dist/plus/integrations/index.js +41 -8
  59. package/dist/plus/integrations/index.js.map +1 -1
  60. package/dist/plus/integrations/integrationService.d.ts +24 -24
  61. package/dist/plus/integrations/integrationService.js +125 -34
  62. package/dist/plus/integrations/integrationService.js.map +1 -1
  63. package/dist/plus/integrations/lite.js +1 -1
  64. package/dist/plus/integrations/lite.js.map +1 -1
  65. package/dist/plus/integrations/manager.d.ts +81 -21
  66. package/dist/plus/integrations/models/actionablePullRequest.d.ts +213 -0
  67. package/dist/plus/integrations/models/actionablePullRequest.js +25 -0
  68. package/dist/plus/integrations/models/actionablePullRequest.js.map +1 -0
  69. package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -46
  70. package/dist/plus/integrations/models/gitHostIntegration.js +22 -8
  71. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  72. package/dist/plus/integrations/models/integration.d.ts +11 -175
  73. package/dist/plus/integrations/models/integration.js +22 -76
  74. package/dist/plus/integrations/models/integration.js.map +1 -1
  75. package/dist/plus/integrations/models/issueTrackerWrites.d.ts +128 -0
  76. package/dist/plus/integrations/models/issueTrackerWrites.js +0 -0
  77. package/dist/plus/integrations/models/issuesIntegration.d.ts +9 -5
  78. package/dist/plus/integrations/models/issuesIntegration.js +5 -3
  79. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  80. package/dist/plus/integrations/models/publicIntegration.d.ts +257 -0
  81. package/dist/plus/integrations/models/publicIntegration.js +21 -0
  82. package/dist/plus/integrations/models/publicIntegration.js.map +1 -0
  83. package/dist/plus/integrations/providerFilters.d.ts +58 -0
  84. package/dist/plus/integrations/providerFilters.js.map +1 -1
  85. package/dist/plus/integrations/providers/actionablePullRequests.d.ts +19 -0
  86. package/dist/plus/integrations/providers/actionablePullRequests.js +32 -0
  87. package/dist/plus/integrations/providers/actionablePullRequests.js.map +1 -0
  88. package/dist/plus/integrations/providers/apiClients.d.ts +1 -2
  89. package/dist/plus/integrations/providers/apiClients.js.map +1 -1
  90. package/dist/plus/integrations/providers/asana.d.ts +3 -2
  91. package/dist/plus/integrations/providers/asana.js +2 -1
  92. package/dist/plus/integrations/providers/asana.js.map +1 -1
  93. package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
  94. package/dist/plus/integrations/providers/azure/azure.js +1 -1
  95. package/dist/plus/integrations/providers/azure/azure.utils.d.ts +10 -3
  96. package/dist/plus/integrations/providers/azure/azure.utils.js +5 -1
  97. package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
  98. package/dist/plus/integrations/providers/azure/models.d.ts +1 -5
  99. package/dist/plus/integrations/providers/azure/models.js +1 -1
  100. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  101. package/dist/plus/integrations/providers/azureDevOps.d.ts +8 -5
  102. package/dist/plus/integrations/providers/azureDevOps.js +2 -1
  103. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  104. package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +5 -4
  105. package/dist/plus/integrations/providers/azureDevOpsServer.js +3 -1
  106. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  107. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +2 -2
  108. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  109. package/dist/plus/integrations/providers/bitbucket/models.d.ts +1 -1
  110. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  111. package/dist/plus/integrations/providers/bitbucket-server.d.ts +5 -4
  112. package/dist/plus/integrations/providers/bitbucket-server.js +2 -1
  113. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  114. package/dist/plus/integrations/providers/bitbucket.d.ts +4 -3
  115. package/dist/plus/integrations/providers/bitbucket.js +2 -1
  116. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  117. package/dist/plus/integrations/providers/github/github.d.ts +0 -1
  118. package/dist/plus/integrations/providers/github/github.js +1 -1
  119. package/dist/plus/integrations/providers/github/github.js.map +1 -1
  120. package/dist/plus/integrations/providers/github.d.ts +29 -11
  121. package/dist/plus/integrations/providers/github.js +195 -78
  122. package/dist/plus/integrations/providers/github.js.map +1 -1
  123. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
  124. package/dist/plus/integrations/providers/gitlab/gitlab.js +1 -2
  125. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  126. package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +14 -1
  127. package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
  128. package/dist/plus/integrations/providers/gitlab/models.d.ts +2 -10
  129. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  130. package/dist/plus/integrations/providers/gitlab.d.ts +7 -5
  131. package/dist/plus/integrations/providers/gitlab.js +2 -1
  132. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  133. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  134. package/dist/plus/integrations/providers/jira-server.d.ts +4 -4
  135. package/dist/plus/integrations/providers/jira-server.js +3 -2
  136. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  137. package/dist/plus/integrations/providers/jira.d.ts +3 -3
  138. package/dist/plus/integrations/providers/jira.js +4 -3
  139. package/dist/plus/integrations/providers/jira.js.map +1 -1
  140. package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +3 -1
  141. package/dist/plus/integrations/providers/jiraIssueByKey.js +1 -1
  142. package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
  143. package/dist/plus/integrations/providers/jiraIssueWriteErrors.d.ts +10 -0
  144. package/dist/plus/integrations/providers/jiraIssueWriteErrors.js +68 -0
  145. package/dist/plus/integrations/providers/jiraIssueWriteErrors.js.map +1 -0
  146. package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +40 -0
  147. package/dist/plus/integrations/providers/jiraIssueWrites.js +397 -0
  148. package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -0
  149. package/dist/plus/integrations/providers/linear.d.ts +4 -3
  150. package/dist/plus/integrations/providers/linear.js +3 -2
  151. package/dist/plus/integrations/providers/linear.js.map +1 -1
  152. package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +1 -1
  153. package/dist/plus/integrations/providers/linearIssuesEtag.js +1 -1
  154. package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
  155. package/dist/plus/integrations/providers/metadata.d.ts +136 -0
  156. package/dist/plus/integrations/providers/metadata.js +513 -0
  157. package/dist/plus/integrations/providers/metadata.js.map +1 -0
  158. package/dist/plus/integrations/providers/models.d.ts +10 -206
  159. package/dist/plus/integrations/providers/models.js +8 -539
  160. package/dist/plus/integrations/providers/models.js.map +1 -1
  161. package/dist/plus/integrations/providers/providersApi.d.ts +7 -3
  162. package/dist/plus/integrations/providers/providersApi.js +23 -11
  163. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  164. package/dist/plus/integrations/providers/trello.d.ts +1 -1
  165. package/dist/plus/integrations/providers/trello.js +2 -1
  166. package/dist/plus/integrations/providers/trello.js.map +1 -1
  167. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +2 -0
  168. package/dist/plus/integrations/providers/utils/providerPaging.js +3 -2
  169. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  170. package/dist/plus/integrations/providers/utils.d.ts +119 -10
  171. package/dist/plus/integrations/providers/utils.js +57 -3
  172. package/dist/plus/integrations/providers/utils.js.map +1 -1
  173. package/dist/plus/integrations/reads/autolinks.d.ts +1 -1
  174. package/dist/plus/integrations/reads/autolinks.js +1 -1
  175. package/dist/plus/integrations/reads/autolinks.js.map +1 -1
  176. package/dist/plus/integrations/reads/broaden.d.ts +1 -1
  177. package/dist/plus/integrations/reads/broaden.js +3 -2
  178. package/dist/plus/integrations/reads/broaden.js.map +1 -1
  179. package/dist/plus/integrations/reads/context.d.ts +1 -1
  180. package/dist/plus/integrations/reads/counts.d.ts +1 -88
  181. package/dist/plus/integrations/reads/counts.js +4 -2
  182. package/dist/plus/integrations/reads/counts.js.map +1 -1
  183. package/dist/plus/integrations/reads/currentAccount.d.ts +1 -18
  184. package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
  185. package/dist/plus/integrations/reads/drains.d.ts +4 -3
  186. package/dist/plus/integrations/reads/drains.js +1 -1
  187. package/dist/plus/integrations/reads/drains.js.map +1 -1
  188. package/dist/plus/integrations/reads/etag.d.ts +174 -3
  189. package/dist/plus/integrations/reads/etag.js +69 -14
  190. package/dist/plus/integrations/reads/etag.js.map +1 -1
  191. package/dist/plus/integrations/reads/filters.d.ts +3 -61
  192. package/dist/plus/integrations/reads/filters.js +1 -1
  193. package/dist/plus/integrations/reads/filters.js.map +1 -1
  194. package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
  195. package/dist/plus/integrations/reads/hierarchy.js +4 -2
  196. package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
  197. package/dist/plus/integrations/reads/issueBatch.d.ts +2 -102
  198. package/dist/plus/integrations/reads/issueBatch.js +3 -4
  199. package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
  200. package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
  201. package/dist/plus/integrations/reads/issueTracker.js +4 -3
  202. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  203. package/dist/plus/integrations/reads/issues.d.ts +1 -1
  204. package/dist/plus/integrations/reads/issues.js +4 -2
  205. package/dist/plus/integrations/reads/issues.js.map +1 -1
  206. package/dist/plus/integrations/reads/paging.d.ts +1 -1
  207. package/dist/plus/integrations/reads/paging.js +1 -1
  208. package/dist/plus/integrations/reads/paging.js.map +1 -1
  209. package/dist/plus/integrations/reads/pullRequestActivity.d.ts +1 -24
  210. package/dist/plus/integrations/reads/pullRequestActivity.js +2 -1
  211. package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -1
  212. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +2 -56
  213. package/dist/plus/integrations/reads/pullRequestBatch.js +23 -3
  214. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  215. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +1 -47
  216. package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
  217. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  218. package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +1 -15
  219. package/dist/plus/integrations/reads/pullRequestCheckLogs.js +2 -1
  220. package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -1
  221. package/dist/plus/integrations/reads/pullRequests.js +4 -2
  222. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  223. package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +1 -16
  224. package/dist/plus/integrations/reads/pullRequestsForCommits.js +2 -1
  225. package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -1
  226. package/dist/plus/integrations/reads/resolveRepository.js +10 -5
  227. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
  228. package/dist/plus/integrations/reads/searchIssues.js +2 -1
  229. package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
  230. package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
  231. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  232. package/dist/plus/integrations/reads/sweeps.d.ts +1 -1
  233. package/dist/plus/integrations/reads/sweeps.js +3 -2
  234. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  235. package/dist/plus/integrations/reads/warnings.d.ts +1 -1
  236. package/dist/plus/integrations/reads/warnings.js +1 -1
  237. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  238. package/dist/plus/integrations/results.d.ts +324 -2
  239. package/dist/plus/integrations/results.js.map +1 -1
  240. package/dist/plus/integrations/telemetry.d.ts +0 -10
  241. package/dist/plus/integrations/telemetry.js +0 -11
  242. package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
  243. package/dist/plus/integrations/utils/domain.utils.js +10 -2
  244. package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
  245. package/dist/plus/integrations/utils/integration.utils.d.ts +2 -6
  246. package/dist/plus/integrations/utils/integration.utils.js +8 -9
  247. package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
  248. package/dist/utils/env/node/exec.js +2 -2
  249. package/dist/utils/keys/chord.d.ts +13 -2
  250. package/dist/utils/keys/chord.js +76 -17
  251. package/dist/utils/keys/chord.js.map +1 -1
  252. package/dist/utils/keys/keybinding.d.ts +12 -0
  253. package/dist/utils/keys/keybinding.js +52 -2
  254. package/dist/utils/keys/keybinding.js.map +1 -1
  255. package/dist/utils/markdown.d.ts +21 -0
  256. package/dist/utils/markdown.js +33 -1
  257. package/dist/utils/markdown.js.map +1 -1
  258. package/docs/integrations.md +174 -19
  259. package/package.json +5 -1
  260. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +0 -1
  261. package/dist/plus/integrations/telemetry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"logParser.js","names":[],"sources":["../../../../git-cli/src/parsers/logParser.ts"],"sourcesContent":["import type { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport { diffHunkRegex, parseDiffFilePaths, parseQuotedRenameOrCopyPaths } from '@gitlens/git/parsers/diffParser.js';\nimport { joinPaths, normalizePath } from '@gitlens/utils/path.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { flattenString, iterateAsyncByDelimiter, iterateByDelimiter, unquoteCString } from '@gitlens/utils/string.js';\nimport type { ExtractAll } from '@gitlens/utils/types.js';\n\nconst commitsMapping = {\n\tsha: '%H',\n\tauthor: '%aN',\n\tauthorEmail: '%aE',\n\tauthorDate: '%at',\n\tcommitter: '%cN',\n\tcommitterEmail: '%cE',\n\tcommitterDate: '%ct',\n\tparents: '%P',\n\ttips: '%D',\n\tmessage: '%B',\n};\n\nexport type CommitsLogParser = LogParser<typeof commitsMapping>;\nlet _commitsParser: CommitsLogParser | undefined;\nexport type CommitsWithFilesLogParser = LogParserWithFilesAndStats<typeof commitsMapping>;\nlet _commitsWithFilesParser: CommitsWithFilesLogParser | undefined;\nexport type CommitsInFileRangeLogParser = LogParserWithFiles<typeof commitsMapping>;\nlet _commitsInFileRangeParser: CommitsInFileRangeLogParser | undefined;\n\nexport type ParsedCommit =\n\t| LogParsedEntry<typeof commitsMapping>\n\t| LogParsedEntryWithFiles<typeof commitsMapping>\n\t| LogParsedEntryWithFilesAndStats<typeof commitsMapping>;\n\nexport function getCommitsLogParser(\n\tincludeFiles: boolean,\n\tinFileRange?: boolean,\n): CommitsLogParser | CommitsWithFilesLogParser | CommitsInFileRangeLogParser {\n\tif (inFileRange) {\n\t\t_commitsInFileRangeParser ??= createLogParserWithPatch(commitsMapping);\n\t\treturn _commitsInFileRangeParser;\n\t}\n\n\tif (includeFiles) {\n\t\t_commitsWithFilesParser ??= createLogParserWithFilesAndStats(commitsMapping);\n\t\treturn _commitsWithFilesParser;\n\t}\n\n\t_commitsParser ??= createLogParser(commitsMapping);\n\treturn _commitsParser;\n}\n\nconst contributorsMapping = { sha: '%H', author: '%aN', email: '%aE', date: '%at', message: '%B' };\n\ntype ContributorsLogParser = LogParser<typeof contributorsMapping>;\nlet _contributorsParser: ContributorsLogParser | undefined;\ntype ContributorsWithStatsLogParser = LogParserWithStats<typeof contributorsMapping>;\nlet _contributorsWithStatsParser: ContributorsWithStatsLogParser | undefined;\n\nexport function getContributorsLogParser(stats?: boolean): ContributorsLogParser | ContributorsWithStatsLogParser {\n\tif (stats) {\n\t\t_contributorsWithStatsParser ??= createLogParserWithStats(contributorsMapping);\n\t\treturn _contributorsWithStatsParser;\n\t}\n\n\t_contributorsParser ??= createLogParser(contributorsMapping);\n\treturn _contributorsParser;\n}\n\nconst graphMapping = {\n\tsha: '%H',\n\tauthor: '%aN',\n\tauthorEmail: '%aE',\n\tauthorDate: '%at',\n\tcommitterDate: '%ct',\n\tparents: '%P',\n\ttips: '%D',\n\tmessage: '%B',\n};\n\nexport type GraphLogParser = LogParser<typeof graphMapping>;\nlet _graphParser: GraphLogParser | undefined;\ntype GraphWithStatsLogParser = LogParserWithStats<typeof graphMapping>;\nlet _graphWithStatsParser: GraphWithStatsLogParser | undefined;\n\n/**\n * Prints `tips` as full refnames (`HEAD -> refs/heads/main`, `refs/remotes/origin/main`, `tag: refs/tags/v1`), whatever\n * `log.decorate` says, since short names can't tell a local branch from a remote-tracking ref of the same name\n */\nexport function getGraphParser(stats?: boolean): GraphLogParser | GraphWithStatsLogParser {\n\tif (stats) {\n\t\tif (_graphWithStatsParser == null) {\n\t\t\t_graphWithStatsParser = createLogParserWithStats(graphMapping);\n\t\t\t_graphWithStatsParser.arguments.push('--decorate=full');\n\t\t}\n\t\treturn _graphWithStatsParser;\n\t}\n\n\tif (_graphParser == null) {\n\t\t_graphParser = createLogParser(graphMapping);\n\t\t_graphParser.arguments.push('--decorate=full');\n\t}\n\treturn _graphParser;\n}\n\ntype ShaLogParser = Parser<string>;\nlet _shaParser: ShaLogParser | undefined;\n\nexport function getShaLogParser(): ShaLogParser {\n\t_shaParser ??= createLogParserSingle('%H');\n\treturn _shaParser;\n}\n\nconst shaAndDateMapping = { sha: '%H', authorDate: '%at', committerDate: '%ct' };\nconst shaAndDateAndTipsMapping = { sha: '%H', authorDate: '%at', committerDate: '%ct', tips: '%D' };\n\ntype ShaAndDatesLogParser = LogParser<typeof shaAndDateMapping & { tips?: string }>;\nlet _shaAndDatesParser: ShaAndDatesLogParser | undefined;\ntype ShaAndDatesAndTipsLogParser = LogParser<typeof shaAndDateAndTipsMapping>;\nlet _shaAndDatesAndTipsParser: ShaAndDatesAndTipsLogParser | undefined;\n\nexport function getShaAndDatesLogParser(includeTips?: boolean): ShaAndDatesLogParser | ShaAndDatesAndTipsLogParser {\n\tif (includeTips) {\n\t\t_shaAndDatesAndTipsParser ??= createLogParser(shaAndDateAndTipsMapping);\n\t\treturn _shaAndDatesAndTipsParser;\n\t}\n\n\t_shaAndDatesParser ??= createLogParser(shaAndDateMapping);\n\treturn _shaAndDatesParser;\n}\n\ntype ShaAndDatesWithFilesLogParser = LogParserWithFiles<typeof shaAndDateMapping & { tips?: string }>;\nlet _shaAndDatesWithFilesParser: ShaAndDatesWithFilesLogParser | undefined;\n\ntype ShaAndDatesAndTipsWithFilesLogParser = LogParserWithFiles<typeof shaAndDateAndTipsMapping>;\nlet _shaAndDatesAndTipsWithFilesParser: ShaAndDatesAndTipsWithFilesLogParser | undefined;\n\nexport function getShaAndDatesWithFilesLogParser(\n\tincludeTips?: boolean,\n): ShaAndDatesWithFilesLogParser | ShaAndDatesAndTipsWithFilesLogParser {\n\tif (includeTips) {\n\t\t_shaAndDatesAndTipsWithFilesParser ??= createLogParserWithFiles(shaAndDateAndTipsMapping);\n\t\treturn _shaAndDatesAndTipsWithFilesParser;\n\t}\n\n\t_shaAndDatesWithFilesParser ??= createLogParserWithFiles(shaAndDateMapping);\n\treturn _shaAndDatesWithFilesParser;\n}\n\nconst shaMapping = { sha: '%H' };\n\ntype ShaAndFilesAndStatsLogParser = LogParserWithFilesAndStats<typeof shaMapping>;\nlet _shaAndFilesAndStatsParser: ShaAndFilesAndStatsLogParser | undefined;\n\nexport function getShaAndFilesAndStatsLogParser(): ShaAndFilesAndStatsLogParser {\n\t_shaAndFilesAndStatsParser ??= createLogParserWithFilesAndStats(shaMapping);\n\treturn _shaAndFilesAndStatsParser;\n}\n\ntype ShaAndFileRangeLogParser = LogParserWithFiles<typeof shaMapping>;\nlet _shaAndFileRangeParser: ShaAndFileRangeLogParser | undefined;\n\nexport function getShaAndFileRangeLogParser(): ShaAndFileRangeLogParser {\n\t_shaAndFileRangeParser ??= createLogParserWithPatch(shaMapping);\n\treturn _shaAndFileRangeParser;\n}\n\ntype ShaAndFileSummaryLogParser = LogParserWithFileSummary<typeof shaMapping>;\nlet _shaAndFileSummaryParser: ShaAndFileSummaryLogParser | undefined;\n\nexport function getShaAndFileSummaryLogParser(): ShaAndFileSummaryLogParser {\n\t_shaAndFileSummaryParser ??= createLogParserWithFileSummary(shaMapping);\n\treturn _shaAndFileSummaryParser;\n}\n\ntype ShaAndStatsLogParser = LogParserWithStats<typeof shaMapping>;\nlet _shaAndStatsParser: ShaAndStatsLogParser | undefined;\n\nexport function getShaAndStatsLogParser(): ShaAndStatsLogParser {\n\t_shaAndStatsParser ??= createLogParserWithStats(shaMapping);\n\treturn _shaAndStatsParser;\n}\n\nconst stashMapping = {\n\tsha: '%H',\n\tauthorDate: '%at',\n\tcommittedDate: '%ct',\n\tparents: '%P',\n\tstashName: '%gd',\n\tsummary: '%gs',\n\t// %s (commit subject) is git's authoritative `On <branch>: …` / `WIP on <branch>: …` record,\n\t// present even when the reflog message (%gs) was customized (autostash, `git stash store -m`).\n\t// Used downstream to extract `stashOnRef` reliably.\n\tcommitSubject: '%s',\n};\n\ntype StashLogParser = LogParser<typeof stashMapping>;\nlet _stashParser: StashLogParser | undefined;\ntype StashLogParserWithFiles = LogParserWithFilesAndStats<typeof stashMapping>;\nlet _stashParserWithFiles: StashLogParserWithFiles | undefined;\n\nexport type ParsedStash = LogParsedEntry<typeof stashMapping>;\nexport type ParsedStashWithFiles = LogParsedEntryWithFilesAndStats<typeof stashMapping>;\n\nexport function getStashLogParser(includeFiles?: false): StashLogParser;\nexport function getStashLogParser(includeFiles: true): StashLogParserWithFiles;\nexport function getStashLogParser(includeFiles?: boolean): StashLogParser | StashLogParserWithFiles;\nexport function getStashLogParser(includeFiles?: boolean): StashLogParser | StashLogParserWithFiles {\n\tif (includeFiles) {\n\t\t_stashParserWithFiles ??= createLogParserWithFilesAndStats(stashMapping);\n\t\treturn _stashParserWithFiles;\n\t}\n\n\t_stashParser ??= createLogParser(stashMapping);\n\treturn _stashParser;\n}\n\ntype StashFilesOnlyLogParser = LogParserWithFilesAndStats<void>;\nlet _stashFilesOnlyParser: StashFilesOnlyLogParser | undefined;\n\nexport function getStashFilesOnlyLogParser(): StashFilesOnlyLogParser {\n\t_stashFilesOnlyParser ??= createLogParserWithFilesAndStats();\n\treturn _stashFilesOnlyParser;\n}\n\n// Parser types\nexport type Parser<T> = {\n\targuments: string[];\n\tseparators: { record: string; field: string };\n\tparse: (data: string | Iterable<string> | undefined) => Generator<T> | Iterable<T>;\n\tparseAsync?: never;\n};\nexport type AsyncParser<T> = {\n\targuments: string[];\n\tseparators: { record: string; field: string };\n\tparse: (data: string | Iterable<string> | undefined) => Generator<T> | Iterable<T>;\n\tparseAsync: (stream: AsyncGenerator<string>) => AsyncGenerator<T>;\n\t/**\n\t * Like `parseAsync` but yields one ARRAY of entries per stream chunk, scanning each chunk\n\t * synchronously with plain `indexOf` (no per-field iterator machinery). Bulk consumers (the\n\t * graph walk) avoid two promise hops per record — thousands of awaited yields collapse to one\n\t * per chunk. Only the plain parser implements it; per-record `parseAsync` remains the\n\t * general-purpose path.\n\t */\n\tparseAsyncBatched?: (stream: AsyncGenerator<string>) => AsyncGenerator<T[]>;\n};\n\nexport type LogParser<T> = AsyncParser<LogParsedEntry<T>>;\ntype LogParserWithFiles<T> = AsyncParser<LogParsedEntryWithFiles<T>>;\ntype LogParserWithFilesAndStats<T> = AsyncParser<LogParsedEntryWithFilesAndStats<T>>;\ntype LogParserWithFileSummary<T> = Parser<LogParsedEntryWithFiles<T>>;\ntype LogParserWithStats<T> = AsyncParser<LogParsedEntryWithStats<T>>;\n\n// Parsed entry types\ntype LogParsedEntry<T> = { [K in keyof T]: string } & { files?: never; stats?: never };\ntype LogParsedEntryWithFiles<T> = { [K in keyof T]: string } & { files: LogParsedFile[]; stats?: never };\ntype LogParsedEntryWithFilesAndStats<T> = { [K in keyof T]: string } & {\n\tfiles: LogParsedFileWithStats[];\n\tstats: LogParsedStatsWithFilesStats;\n};\ntype LogParsedEntryWithStats<T> = { [K in keyof T]: string } & { stats: LogParsedStats };\n\n// Parsed types\nexport interface LogParsedFile {\n\tstatus?: string;\n\tpath: string;\n\toriginalPath?: string;\n\tadditions?: never;\n\tdeletions?: never;\n\trange?: LogParsedRange;\n\toriginalRange?: LogParsedRange;\n\t/** Git file mode (e.g., 100644=regular, 100755=executable, 120000=symlink, 160000=submodule) */\n\tmode?: string;\n\t/** For submodule entries (mode 160000), the commit SHA the submodule points to */\n\toid?: string;\n\t/** For submodule entries (mode 160000), the previous commit SHA */\n\tpreviousOid?: string;\n}\ntype LogParsedFileWithStats = Omit<LogParsedFile, 'additions' | 'deletions'> & {\n\tadditions: number;\n\tdeletions: number;\n};\ninterface LogParsedRange {\n\tstartLine: number;\n\tendLine: number;\n}\ninterface LogParsedStats {\n\tfiles: number;\n\tadditions: number;\n\tdeletions: number;\n}\ninterface LogParsedStatsWithFilesStats {\n\tfiles: { added: number; changed: number; deleted: number };\n\tadditions: number;\n\tdeletions: number;\n}\n\nconst recordSep = '\\x1E'; // ASCII Record Separator character\nconst recordFormatSep = '%x1E';\nconst fieldSep = '\\x1D'; // ASCII Group Separator character\nconst fieldFormatSep = '%x1D';\n\n// `push(...items)` throws a RangeError once `items` is large enough to overflow the call stack\nfunction appendAll<T>(target: T[], items: readonly T[]): void {\n\tfor (const item of items) {\n\t\ttarget.push(item);\n\t}\n}\n\n// A complete record terminates every mapped field with a field separator — a cancelled/early-closed\n// stream resolves cleanly with a truncated tail missing at least the final terminator.\nfunction isCompleteRecord(record: string, requiredFields: number): boolean {\n\tlet count = 0;\n\tlet index = -1;\n\twhile (count < requiredFields) {\n\t\tindex = record.indexOf(fieldSep, index + 1);\n\t\tif (index === -1) return false;\n\n\t\tcount++;\n\t}\n\treturn true;\n}\n\nexport function createLogParser<T extends Record<string, string>>(mapping: ExtractAll<T, string>): LogParser<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`];\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntry<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParser.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntry<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tentry = {} as unknown as LogParsedEntry<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\t\t\t\tif (fieldCount >= keys.length) continue;\n\n\t\t\t\tcount++;\n\t\t\t\tentry[keys[fieldCount++]] = field.value as T[keyof T];\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntry<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParser.parseAsync', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntry<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\t\t\t// Drop a truncated tail (cancelled/early-closed stream) instead of yielding undefined/partial fields.\n\t\t\tif (!isCompleteRecord(record, keys.length)) continue;\n\n\t\t\tentry = {} as unknown as LogParsedEntry<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\t\t\t\tif (fieldCount >= keys.length) continue;\n\n\t\t\t\tcount++;\n\t\t\t\tentry[keys[fieldCount++]] = field.value as T[keyof T];\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\t// Builds one entry from a complete record with a plain `indexOf` walk. Matches `parseAsync`'s\n\t// semantics exactly: fields beyond the mapping are ignored, and every mapped field is\n\t// terminated by a field separator (the format string appends one after each field).\n\tfunction parseRecord(record: string): LogParsedEntry<T> {\n\t\t// Fields sliced out of the record become long-lived (graph rows); flatten the record so they\n\t\t// pin a record-sized copy rather than the full walk output the record was sliced from.\n\t\trecord = flattenString(record);\n\t\tconst entry = {} as unknown as LogParsedEntry<T>;\n\t\tlet start = 0;\n\t\tfor (const key of keys) {\n\t\t\tconst end = record.indexOf(fieldSep, start);\n\t\t\tif (end === -1) break;\n\n\t\t\tentry[key] = record.substring(start, end) as T[keyof T];\n\t\t\tstart = end + 1;\n\t\t}\n\t\treturn entry;\n\t}\n\n\tasync function* parseAsyncBatched(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntry<T>[]> {\n\t\tusing sw = maybeStopWatch('Git.LogParser.parseAsyncBatched', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tlet count = 0;\n\t\tlet buffer = '';\n\t\tfor await (const chunk of stream) {\n\t\t\tbuffer += chunk;\n\n\t\t\tlet batch: LogParsedEntry<T>[] | undefined;\n\t\t\tlet start = 0;\n\t\t\twhile (true) {\n\t\t\t\tconst end = buffer.indexOf(recordSep, start);\n\t\t\t\tif (end === -1) break;\n\n\t\t\t\tif (end > start) {\n\t\t\t\t\t(batch ??= []).push(parseRecord(buffer.substring(start, end)));\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tstart = end + 1;\n\t\t\t}\n\t\t\tif (start > 0) {\n\t\t\t\tbuffer = buffer.substring(start);\n\t\t\t}\n\t\t\tif (batch != null) {\n\t\t\t\tyield batch;\n\t\t\t}\n\t\t}\n\t\t// Trailing record (the stream doesn't end with a record separator); a truncated tail from a\n\t\t// cancelled/early-closed stream is missing a field terminator and must be dropped, not parsed.\n\t\tif (buffer.length > 0 && isCompleteRecord(buffer, keys.length)) {\n\t\t\tcount++;\n\t\t\tyield [parseRecord(buffer)];\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t\tparseAsyncBatched: parseAsyncBatched,\n\t};\n}\n\nfunction createLogParserWithFilesAndStats(): LogParserWithFilesAndStats<void>;\nfunction createLogParserWithFilesAndStats<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFilesAndStats<T>;\nfunction createLogParserWithFilesAndStats<T extends Record<string, string> | void>(\n\tmapping?: ExtractAll<T, string>,\n): LogParserWithFilesAndStats<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tif (mapping != null) {\n\t\tfor (const key in mapping) {\n\t\t\tkeys.push(key);\n\t\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t\t}\n\t}\n\t// Use --raw instead of --summary to get accurate mode info for ALL files (not just creates/deletes)\n\t// This allows us to reliably detect submodules (mode 160000) even for modifications\n\tconst args = [`--format=${format}`, '--numstat', '--raw'];\n\n\tfunction parseFilesAndStats(content: string): LogParsedFileWithStats[] {\n\t\tconst files: LogParsedFileWithStats[] = [];\n\t\tif (!content?.length) return files;\n\n\t\t// Map to store info from --raw lines: path -> { mode, status, originalPath, oid?, previousOid? }\n\t\t// Raw format: :<old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\\t<path>[\\t<new_path>]\n\t\tconst infoMap = new Map<\n\t\t\tstring,\n\t\t\t{ mode: string; status: string; originalPath?: string; oid?: string; previousOid?: string }\n\t\t>();\n\n\t\tlet startIndex: number;\n\t\tlet endIndex: number;\n\n\t\t// Single pass: --raw lines come first, then --numstat lines\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tif (!line) continue;\n\n\t\t\tif (line.charCodeAt(0) === 58 /* ':' */) {\n\t\t\t\t// --raw format: :<old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\\t<path>[\\t<new_path>]\n\t\t\t\tconst tabIndex = line.indexOf('\\t');\n\t\t\t\tif (tabIndex === -1) continue;\n\n\t\t\t\t// Parse metadata using indexOf instead of split() to avoid array allocation\n\t\t\t\t// Format after ':': <old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\n\n\t\t\t\t// Skip old_mode, find new_mode\n\t\t\t\tstartIndex = line.indexOf(' ') + 1;\n\t\t\t\tif (startIndex === 0) continue;\n\n\t\t\t\tendIndex = line.indexOf(' ', startIndex);\n\t\t\t\tif (endIndex === -1) continue;\n\n\t\t\t\tconst newMode = line.substring(startIndex, endIndex);\n\n\t\t\t\t// Parse old_sha and new_sha positions\n\t\t\t\tconst oldShaStart = endIndex + 1;\n\t\t\t\tconst oldShaEnd = line.indexOf(' ', oldShaStart);\n\t\t\t\tif (oldShaEnd === -1) continue;\n\n\t\t\t\tconst newShaStart = oldShaEnd + 1;\n\t\t\t\tconst newShaEnd = line.indexOf(' ', newShaStart);\n\t\t\t\tif (newShaEnd === -1) continue;\n\n\t\t\t\t// For submodules (mode 160000), capture the commit SHAs\n\t\t\t\tlet oid: string | undefined;\n\t\t\t\tlet previousOid: string | undefined;\n\t\t\t\tif (newMode === '160000') {\n\t\t\t\t\tpreviousOid = line.substring(oldShaStart, oldShaEnd);\n\t\t\t\t\toid = line.substring(newShaStart, newShaEnd);\n\t\t\t\t}\n\n\t\t\t\t// Status is first char after the last space\n\t\t\t\tstartIndex = newShaEnd;\n\t\t\t\tconst status = line.charAt(startIndex + 1);\n\n\t\t\t\t// Parse path(s) using indexOf instead of split\n\t\t\t\tconst pathPart = line.substring(tabIndex + 1);\n\t\t\t\tlet path: string;\n\t\t\t\tlet originalPath: string | undefined;\n\n\t\t\t\t// Each field is trimmed as written, to match parseCopyOrRename, which trims an unquoted name. A\n\t\t\t\t// quoted name's whitespace is inside its quotes, so it is part of the name and kept\n\t\t\t\tconst pathTabIndex = pathPart.indexOf('\\t');\n\t\t\t\tif ((status === 'R' || status === 'C') && pathTabIndex !== -1) {\n\t\t\t\t\t// For renames/copies: old_path\\tnew_path\n\t\t\t\t\toriginalPath = unquoteCString(pathPart.substring(0, pathTabIndex).trim());\n\t\t\t\t\tpath = unquoteCString(pathPart.substring(pathTabIndex + 1).trim());\n\t\t\t\t} else {\n\t\t\t\t\tpath = unquoteCString(pathPart.trim());\n\t\t\t\t}\n\n\t\t\t\tinfoMap.set(path, {\n\t\t\t\t\tmode: newMode,\n\t\t\t\t\tstatus: status,\n\t\t\t\t\toriginalPath: originalPath,\n\t\t\t\t\toid: oid,\n\t\t\t\t\tpreviousOid: previousOid,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// --numstat format: <additions>\\t<deletions>\\t<path>\n\t\t\t\t// With renames: <additions>\\t<deletions>\\t{prefix/old => new/suffix}\n\t\t\t\tendIndex = line.indexOf('\\t');\n\t\t\t\tif (endIndex === -1) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst additions = line.substring(0, endIndex);\n\n\t\t\t\tstartIndex = endIndex + 1;\n\t\t\t\tendIndex = line.indexOf('\\t', startIndex);\n\t\t\t\tif (endIndex === -1) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst deletions = line.substring(startIndex, endIndex);\n\n\t\t\t\tlet path = line.substring(endIndex + 1);\n\t\t\t\tlet originalPath: string | undefined;\n\n\t\t\t\t// Parse rename format from numstat (e.g., \"{old => new}/path\"), which comes back trimmed as --raw's is\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(path, false));\n\n\t\t\t\t// Look up --raw info for this path (keyed by the new/destination path)\n\t\t\t\tconst info = infoMap.get(path);\n\n\t\t\t\t// Use status from --raw if available; provides accurate status (A/D/M/R/C/T)\n\t\t\t\tconst status = info?.status ?? (originalPath ? 'R' : 'M');\n\n\t\t\t\t// Use originalPath from --raw if available (cleaner than numstat format)\n\t\t\t\tif (info?.originalPath) {\n\t\t\t\t\toriginalPath = info.originalPath;\n\t\t\t\t}\n\n\t\t\t\tconst file: LogParsedFileWithStats = {\n\t\t\t\t\tstatus: status,\n\t\t\t\t\tpath: path,\n\t\t\t\t\toriginalPath: originalPath,\n\t\t\t\t\tadditions: additions === '-' ? 0 : parseInt(additions, 10) || 0,\n\t\t\t\t\tdeletions: deletions === '-' ? 0 : parseInt(deletions, 10) || 0,\n\t\t\t\t\t// Store mode for consumers to derive file type (160000=submodule, 100755=executable, etc.)\n\t\t\t\t\tmode: info?.mode,\n\t\t\t\t\toid: info?.oid,\n\t\t\t\t\tpreviousOid: info?.previousOid,\n\t\t\t\t};\n\n\t\t\t\tfiles.push(file);\n\t\t\t}\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithFilesAndStats<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithFilesAndStats.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFilesAndStats<T>;\n\t\tlet files: LogParsedFileWithStats[];\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFilesAndStats<T>;\n\t\t\tfiles = [];\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFilesAndStats<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commits and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tappendAll(files, parseFilesAndStats(summary));\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentry.files = files;\n\t\t\tif (files.length) {\n\t\t\t\tentry.stats = { additions: 0, deletions: 0, files: { added: 0, deleted: 0, changed: 0 } };\n\n\t\t\t\tfor (const f of files) {\n\t\t\t\t\tif (f.additions || f.deletions) {\n\t\t\t\t\t\tentry.stats.additions += f.additions ?? 0;\n\t\t\t\t\t\tentry.stats.deletions += f.deletions ?? 0;\n\t\t\t\t\t\tif (f.status === 'A' || f.status === '?') {\n\t\t\t\t\t\t\tentry.stats.files.added++;\n\t\t\t\t\t\t} else if (f.status === 'D') {\n\t\t\t\t\t\t\tentry.stats.files.deleted++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tentry.stats.files.changed++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntryWithFilesAndStats<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithFilesAndStats.parseAsync', {\n\t\t\tlog: { onlyExit: true, level: 'debug' },\n\t\t});\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFilesAndStats<T>;\n\t\tlet files: LogParsedFileWithStats[];\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\t\t\t// Drop a truncated tail (cancelled/early-closed stream) instead of yielding undefined/partial fields.\n\t\t\tif (!isCompleteRecord(record, keys.length)) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFilesAndStats<T>;\n\t\t\tfiles = [];\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFilesAndStats<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commits and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tappendAll(files, parseFilesAndStats(summary));\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentry.files = files;\n\t\t\tif (files.length) {\n\t\t\t\tentry.stats = { additions: 0, deletions: 0, files: { added: 0, deleted: 0, changed: 0 } };\n\n\t\t\t\tfor (const f of files) {\n\t\t\t\t\tif (f.additions || f.deletions) {\n\t\t\t\t\t\tentry.stats.additions += f.additions ?? 0;\n\t\t\t\t\t\tentry.stats.deletions += f.deletions ?? 0;\n\t\t\t\t\t\tif (f.status === 'A' || f.status === '?') {\n\t\t\t\t\t\t\tentry.stats.files.added++;\n\t\t\t\t\t\t} else if (f.status === 'D') {\n\t\t\t\t\t\t\tentry.stats.files.deleted++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tentry.stats.files.changed++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithFileSummary(): LogParserWithFileSummary<void>;\nfunction createLogParserWithFileSummary<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFileSummary<T>;\nfunction createLogParserWithFileSummary<T extends Record<string, string> | void>(\n\tmapping?: ExtractAll<T, string>,\n): LogParserWithFileSummary<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tif (mapping != null) {\n\t\tfor (const key in mapping) {\n\t\t\tkeys.push(key);\n\t\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t\t}\n\t}\n\tconst args = [`--format=${format}`, '--summary'];\n\n\tfunction parseFileSummary(content: string): LogParsedFile[] {\n\t\tconst files: LogParsedFile[] = [];\n\t\tif (!content?.length) return files;\n\n\t\tlet startIndex;\n\n\t\tlet path;\n\t\tlet originalPath;\n\t\tlet status;\n\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tif (!line) continue;\n\n\t\t\tif (line.startsWith(' rename ')) {\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(line.substring(8 /* move past ' rename ' */), true));\n\t\t\t\tfiles.push({ path: path, originalPath: originalPath, status: 'R' });\n\t\t\t} else if (line.startsWith(' copy ')) {\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(line.substring(6 /* move past ' copy ' */), true));\n\t\t\t\tfiles.push({ path: path, originalPath: originalPath, status: 'C' });\n\t\t\t} else {\n\t\t\t\tif (line.startsWith(' create mode ')) {\n\t\t\t\t\tstatus = 'A';\n\t\t\t\t} else if (line.startsWith(' delete mode ')) {\n\t\t\t\t\tstatus = 'D';\n\t\t\t\t} else {\n\t\t\t\t\t// Ignore \" mode change \" lines\n\t\t\t\t\tif (!line.startsWith(' mode change ')) {\n\t\t\t\t\t\tdebugger;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstartIndex = line.indexOf(' ', 13 /* move past 'create mode <num>' or 'delete mode <num>' */);\n\t\t\t\tif (startIndex > -1) {\n\t\t\t\t\tpath = unquoteCString(line.substring(startIndex + 1));\n\t\t\t\t\tfiles.push({ path: path, status: status });\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithFileSummary.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet files: LogParsedFile[];\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfiles = [];\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commits and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tappendAll(files, parseFileSummary(summary));\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentry.files = files;\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t};\n}\n\n/**\n * Reads a numstat or summary name, or the two names of a rename or copy, trimmed as git wrote them: an unquoted name\n * is trimmed, while a quoted one keeps the whitespace inside its quotes\n */\nfunction parseCopyOrRename(field: string, stripPercentage: boolean): { path: string; originalPath?: string } {\n\tconst path = field.trim();\n\tif (path.includes('\"')) {\n\t\tconst quoted = parseQuotedRenameOrCopyPaths(path, stripPercentage);\n\t\tif (quoted != null) return quoted;\n\t}\n\n\tconst renameIndex = path.indexOf(' => ');\n\tif (renameIndex === -1) return { path: path };\n\n\tlet hasBraces = true;\n\n\tlet openIndex = path.indexOf('{');\n\tif (openIndex === -1) {\n\t\thasBraces = false;\n\t\topenIndex = 0;\n\t}\n\n\tlet closeIndex = path.indexOf('}', openIndex);\n\tif (closeIndex === -1) {\n\t\thasBraces = false;\n\t\tcloseIndex = path.length;\n\t}\n\n\tconst prefix = path.substring(0, openIndex);\n\tconst fromPart = path.substring(hasBraces ? openIndex + 1 : 0, renameIndex);\n\tlet toPart = path.substring(renameIndex + 4, closeIndex);\n\tlet suffix = path.substring(closeIndex + 1);\n\n\t// Check for percentage marker which always appears at the end as (xx%)\n\tif (stripPercentage) {\n\t\tif (hasBraces) {\n\t\t\tif (suffix.endsWith('%)')) {\n\t\t\t\t// Find the last open paren that starts the percentage\n\t\t\t\tconst percentPos = suffix.lastIndexOf(' (');\n\t\t\t\tif (percentPos > -1) {\n\t\t\t\t\tsuffix = suffix.substring(0, percentPos);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (toPart.endsWith('%)')) {\n\t\t\t// Find the last open paren that starts the percentage\n\t\t\tconst percentPos = toPart.lastIndexOf(' (');\n\t\t\tif (percentPos > -1) {\n\t\t\t\ttoPart = toPart.substring(0, percentPos);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tpath: normalizePath(joinPaths(prefix, toPart, suffix).trim()),\n\t\toriginalPath: normalizePath(joinPaths(prefix, fromPart, suffix).trim()),\n\t};\n}\n\nfunction createLogParserSingle(field: string): Parser<string> {\n\tconst args = ['-z', `--format=${field}`];\n\n\tfunction parse(data: string | Iterable<string> | undefined): Iterable<string> {\n\t\tusing _sw = maybeStopWatch('Git.LogParserSingle.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\treturn data ? iterateByDelimiter(data, '\\0') : [];\n\t}\n\n\treturn { arguments: args, separators: { record: '\\0', field: '\\0' }, parse: parse };\n}\n\nfunction createLogParserWithPatch<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFiles<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`];\n\n\tfunction parsePatch(content: string): LogParsedFile | undefined {\n\t\tconst lines = iterateByDelimiter(content, '\\n');\n\t\tlet line = lines.next();\n\t\tif (line.done) return undefined;\n\n\t\tif (!content.startsWith('diff --git ')) return undefined;\n\n\t\tconst paths = parseDiffFilePaths(content);\n\t\tif (paths == null) return undefined;\n\n\t\twhile (!line.done && !line.value.startsWith('@@ ')) {\n\t\t\tline = lines.next();\n\t\t}\n\n\t\tconst rangeMatch = line.value.match(diffHunkRegex);\n\n\t\tlet range: LogParsedRange | undefined;\n\t\tlet originalRange: LogParsedRange | undefined;\n\t\tif (rangeMatch != null) {\n\t\t\tlet start = parseInt(rangeMatch[1], 10);\n\t\t\tlet count = rangeMatch[2] ? parseInt(rangeMatch[2], 10) : 1;\n\n\t\t\toriginalRange = start && count ? { startLine: start, endLine: start + count - 1 } : undefined;\n\n\t\t\tstart = parseInt(rangeMatch[3], 10);\n\t\t\tcount = rangeMatch[4] ? parseInt(rangeMatch[4], 10) : 1;\n\n\t\t\trange = start && count ? { startLine: start, endLine: start + count - 1 } : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tstatus: 'M' satisfies GitFileIndexStatus,\n\t\t\tpath: paths.path,\n\t\t\toriginalPath: undefined,\n\t\t\trange: range,\n\t\t\toriginalRange: originalRange,\n\t\t};\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithPatch.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and patch, if any\n\t\t\t\t\tconst patch = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tconst file = parsePatch(patch);\n\t\t\t\t\tentry.files = file != null ? [file] : [];\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithPatch.parseAsync', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\t\t\t// Drop a truncated tail (cancelled/early-closed stream) instead of yielding undefined/partial fields.\n\t\t\tif (!isCompleteRecord(record, keys.length)) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and patch, if any\n\t\t\t\t\tconst patch = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tconst file = parsePatch(patch);\n\t\t\t\t\tentry.files = file != null ? [file] : [];\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithStats<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithStats<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`, '--shortstat'];\n\n\tfunction parseStats(content: string): LogParsedStats {\n\t\tconst stats: LogParsedStats = { files: 0, additions: 0, deletions: 0 };\n\t\tcontent = content?.trim();\n\t\tif (!content?.length) return { files: 0, additions: 0, deletions: 0 };\n\n\t\tlet filesEnd;\n\t\tlet filesIndex = content.indexOf(' files changed');\n\t\tif (filesIndex === -1) {\n\t\t\tfilesIndex = content.indexOf(' file changed');\n\t\t\tif (filesIndex === -1) return stats;\n\n\t\t\tfilesEnd = filesIndex + ' file changed'.length;\n\t\t} else {\n\t\t\tfilesEnd = filesIndex + ' files changed'.length;\n\t\t}\n\n\t\t// Extract number before \" files changed\"\n\t\tconst filesPart = content.substring(0, filesIndex).trim();\n\t\tstats.files = parseInt(filesPart, 10) || 0;\n\n\t\t// Extract additions if present\n\t\tconst additionsIndex = content.indexOf(' insertion', filesEnd);\n\t\tif (additionsIndex !== -1) {\n\t\t\t// Look for the number before \"insertion(+)\" or \"insertions(+)\"\n\t\t\tconst spaceIndex = content.lastIndexOf(' ', additionsIndex - 1);\n\t\t\tif (spaceIndex !== -1) {\n\t\t\t\tconst additionsPart = content.substring(spaceIndex, additionsIndex).trim();\n\t\t\t\tstats.additions = parseInt(additionsPart, 10) || 0;\n\t\t\t}\n\t\t}\n\n\t\t// Extract deletions if present\n\t\tconst deletionsIndex = content.indexOf(' deletion', filesEnd);\n\t\tif (deletionsIndex !== -1) {\n\t\t\t// Look for the number before \"\"deletion(-)\" or \"deletions(-)\"\n\t\t\tconst spaceIndex = content.lastIndexOf(' ', deletionsIndex - 1);\n\t\t\tif (spaceIndex !== -1) {\n\t\t\t\tconst deletionsPart = content.substring(spaceIndex, deletionsIndex).trim();\n\t\t\t\tstats.deletions = parseInt(deletionsPart, 10) || 0;\n\t\t\t}\n\t\t}\n\n\t\treturn stats;\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithStats<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithStats.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithStats<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithStats<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithStats<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tentry.stats = parseStats(summary);\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntryWithStats<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithStats.parseAsync', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithStats<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithStats<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithStats<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tentry.stats = parseStats(summary);\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithFiles<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFiles<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`, '--name-only'];\n\n\tfunction parseFileNames(content: string): LogParsedFile[] {\n\t\tconst files: LogParsedFile[] = [];\n\t\tif (!content?.length) return files;\n\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tconst trimmed = line.trim();\n\t\t\tif (!trimmed) continue;\n\n\t\t\tfiles.push({ path: unquoteCString(trimmed) });\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.createLogParserWithFiles.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and files, if any\n\t\t\t\t\tconst files = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tentry.files = parseFileNames(files);\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.createLogParserWithFiles.parseAsync', {\n\t\t\tlog: { onlyExit: true, level: 'debug' },\n\t\t});\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and files, if any\n\t\t\t\t\tconst files = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tentry.files = parseFileNames(files);\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n"],"mappings":";;;;;;AAOA,MAAM,iBAAiB;CACtB,KAAK;CACL,QAAQ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N,WAAW;EACX,YAAY;GAAE,QAAQ;GAAW,OAAO;EAAS;EAC1C;EACK;CACb;AACD"}
1
+ {"version":3,"file":"logParser.js","names":[],"sources":["../../../../git-cli/src/parsers/logParser.ts"],"sourcesContent":["import type { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport { diffHunkRegex, parseDiffFilePaths, parseQuotedRenameOrCopyPaths } from '@gitlens/git/parsers/diffParser.js';\nimport { joinPaths, normalizePath } from '@gitlens/utils/path.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { flattenString, iterateByDelimiter, unquoteCString } from '@gitlens/utils/string.js';\nimport type { ExtractAll } from '@gitlens/utils/types.js';\n\nconst commitsMapping = {\n\tsha: '%H',\n\tauthor: '%aN',\n\tauthorEmail: '%aE',\n\tauthorDate: '%at',\n\tcommitter: '%cN',\n\tcommitterEmail: '%cE',\n\tcommitterDate: '%ct',\n\tparents: '%P',\n\ttips: '%D',\n\tmessage: '%B',\n};\n\nexport type CommitsLogParser = LogParser<typeof commitsMapping>;\nlet _commitsParser: CommitsLogParser | undefined;\nexport type CommitsWithFilesLogParser = LogParserWithFilesAndStats<typeof commitsMapping>;\nlet _commitsWithFilesParser: CommitsWithFilesLogParser | undefined;\nexport type CommitsInFileRangeLogParser = LogParserWithFiles<typeof commitsMapping>;\nlet _commitsInFileRangeParser: CommitsInFileRangeLogParser | undefined;\n\nexport type ParsedCommit =\n\t| LogParsedEntry<typeof commitsMapping>\n\t| LogParsedEntryWithFiles<typeof commitsMapping>\n\t| LogParsedEntryWithFilesAndStats<typeof commitsMapping>;\n\nexport function getCommitsLogParser(\n\tincludeFiles: boolean,\n\tinFileRange?: boolean,\n): CommitsLogParser | CommitsWithFilesLogParser | CommitsInFileRangeLogParser {\n\tif (inFileRange) {\n\t\t_commitsInFileRangeParser ??= createLogParserWithPatch(commitsMapping);\n\t\treturn _commitsInFileRangeParser;\n\t}\n\n\tif (includeFiles) {\n\t\t_commitsWithFilesParser ??= createLogParserWithFilesAndStats(commitsMapping);\n\t\treturn _commitsWithFilesParser;\n\t}\n\n\t_commitsParser ??= createLogParser(commitsMapping);\n\treturn _commitsParser;\n}\n\nconst contributorsMapping = { sha: '%H', author: '%aN', email: '%aE', date: '%at', message: '%B' };\n\ntype ContributorsLogParser = LogParser<typeof contributorsMapping>;\nlet _contributorsParser: ContributorsLogParser | undefined;\ntype ContributorsWithStatsLogParser = LogParserWithStats<typeof contributorsMapping>;\nlet _contributorsWithStatsParser: ContributorsWithStatsLogParser | undefined;\n\nexport function getContributorsLogParser(stats?: boolean): ContributorsLogParser | ContributorsWithStatsLogParser {\n\tif (stats) {\n\t\t_contributorsWithStatsParser ??= createLogParserWithStats(contributorsMapping);\n\t\treturn _contributorsWithStatsParser;\n\t}\n\n\t_contributorsParser ??= createLogParser(contributorsMapping);\n\treturn _contributorsParser;\n}\n\nconst graphMapping = {\n\tsha: '%H',\n\tauthor: '%aN',\n\tauthorEmail: '%aE',\n\tauthorDate: '%at',\n\tcommitterDate: '%ct',\n\tparents: '%P',\n\ttips: '%D',\n\tmessage: '%B',\n};\n\nexport type GraphLogParser = LogParser<typeof graphMapping>;\nlet _graphParser: GraphLogParser | undefined;\ntype GraphWithStatsLogParser = LogParserWithStats<typeof graphMapping>;\nlet _graphWithStatsParser: GraphWithStatsLogParser | undefined;\n\n/**\n * Prints `tips` as full refnames (`HEAD -> refs/heads/main`, `refs/remotes/origin/main`, `tag: refs/tags/v1`), whatever\n * `log.decorate` says, since short names can't tell a local branch from a remote-tracking ref of the same name\n */\nexport function getGraphParser(stats?: boolean): GraphLogParser | GraphWithStatsLogParser {\n\tif (stats) {\n\t\tif (_graphWithStatsParser == null) {\n\t\t\t_graphWithStatsParser = createLogParserWithStats(graphMapping);\n\t\t\t_graphWithStatsParser.arguments.push('--decorate=full');\n\t\t}\n\t\treturn _graphWithStatsParser;\n\t}\n\n\tif (_graphParser == null) {\n\t\t_graphParser = createLogParser(graphMapping);\n\t\t_graphParser.arguments.push('--decorate=full');\n\t}\n\treturn _graphParser;\n}\n\ntype ShaLogParser = Parser<string>;\nlet _shaParser: ShaLogParser | undefined;\n\nexport function getShaLogParser(): ShaLogParser {\n\t_shaParser ??= createLogParserSingle('%H');\n\treturn _shaParser;\n}\n\nconst shaAndDateMapping = { sha: '%H', authorDate: '%at', committerDate: '%ct' };\nconst shaAndDateAndTipsMapping = { sha: '%H', authorDate: '%at', committerDate: '%ct', tips: '%D' };\n\ntype ShaAndDatesLogParser = LogParser<typeof shaAndDateMapping & { tips?: string }>;\nlet _shaAndDatesParser: ShaAndDatesLogParser | undefined;\ntype ShaAndDatesAndTipsLogParser = LogParser<typeof shaAndDateAndTipsMapping>;\nlet _shaAndDatesAndTipsParser: ShaAndDatesAndTipsLogParser | undefined;\n\nexport function getShaAndDatesLogParser(includeTips?: boolean): ShaAndDatesLogParser | ShaAndDatesAndTipsLogParser {\n\tif (includeTips) {\n\t\t_shaAndDatesAndTipsParser ??= createLogParser(shaAndDateAndTipsMapping);\n\t\treturn _shaAndDatesAndTipsParser;\n\t}\n\n\t_shaAndDatesParser ??= createLogParser(shaAndDateMapping);\n\treturn _shaAndDatesParser;\n}\n\ntype ShaAndDatesWithFilesLogParser = LogParserWithFiles<typeof shaAndDateMapping & { tips?: string }>;\nlet _shaAndDatesWithFilesParser: ShaAndDatesWithFilesLogParser | undefined;\n\ntype ShaAndDatesAndTipsWithFilesLogParser = LogParserWithFiles<typeof shaAndDateAndTipsMapping>;\nlet _shaAndDatesAndTipsWithFilesParser: ShaAndDatesAndTipsWithFilesLogParser | undefined;\n\nexport function getShaAndDatesWithFilesLogParser(\n\tincludeTips?: boolean,\n): ShaAndDatesWithFilesLogParser | ShaAndDatesAndTipsWithFilesLogParser {\n\tif (includeTips) {\n\t\t_shaAndDatesAndTipsWithFilesParser ??= createLogParserWithFiles(shaAndDateAndTipsMapping);\n\t\treturn _shaAndDatesAndTipsWithFilesParser;\n\t}\n\n\t_shaAndDatesWithFilesParser ??= createLogParserWithFiles(shaAndDateMapping);\n\treturn _shaAndDatesWithFilesParser;\n}\n\nconst shaMapping = { sha: '%H' };\n\ntype ShaAndFilesAndStatsLogParser = LogParserWithFilesAndStats<typeof shaMapping>;\nlet _shaAndFilesAndStatsParser: ShaAndFilesAndStatsLogParser | undefined;\n\nexport function getShaAndFilesAndStatsLogParser(): ShaAndFilesAndStatsLogParser {\n\t_shaAndFilesAndStatsParser ??= createLogParserWithFilesAndStats(shaMapping);\n\treturn _shaAndFilesAndStatsParser;\n}\n\ntype ShaAndFileRangeLogParser = LogParserWithFiles<typeof shaMapping>;\nlet _shaAndFileRangeParser: ShaAndFileRangeLogParser | undefined;\n\nexport function getShaAndFileRangeLogParser(): ShaAndFileRangeLogParser {\n\t_shaAndFileRangeParser ??= createLogParserWithPatch(shaMapping);\n\treturn _shaAndFileRangeParser;\n}\n\ntype ShaAndFileSummaryLogParser = LogParserWithFileSummary<typeof shaMapping>;\nlet _shaAndFileSummaryParser: ShaAndFileSummaryLogParser | undefined;\n\nexport function getShaAndFileSummaryLogParser(): ShaAndFileSummaryLogParser {\n\t_shaAndFileSummaryParser ??= createLogParserWithFileSummary(shaMapping);\n\treturn _shaAndFileSummaryParser;\n}\n\ntype ShaAndStatsLogParser = LogParserWithStats<typeof shaMapping>;\nlet _shaAndStatsParser: ShaAndStatsLogParser | undefined;\n\nexport function getShaAndStatsLogParser(): ShaAndStatsLogParser {\n\t_shaAndStatsParser ??= createLogParserWithStats(shaMapping);\n\treturn _shaAndStatsParser;\n}\n\nconst stashMapping = {\n\tsha: '%H',\n\tauthorDate: '%at',\n\tcommittedDate: '%ct',\n\tparents: '%P',\n\tstashName: '%gd',\n\tsummary: '%gs',\n\t// %s (commit subject) is git's authoritative `On <branch>: …` / `WIP on <branch>: …` record,\n\t// present even when the reflog message (%gs) was customized (autostash, `git stash store -m`).\n\t// Used downstream to extract `stashOnRef` reliably.\n\tcommitSubject: '%s',\n};\n\ntype StashLogParser = LogParser<typeof stashMapping>;\nlet _stashParser: StashLogParser | undefined;\ntype StashLogParserWithFiles = LogParserWithFilesAndStats<typeof stashMapping>;\nlet _stashParserWithFiles: StashLogParserWithFiles | undefined;\n\nexport type ParsedStash = LogParsedEntry<typeof stashMapping>;\nexport type ParsedStashWithFiles = LogParsedEntryWithFilesAndStats<typeof stashMapping>;\n\nexport function getStashLogParser(includeFiles?: false): StashLogParser;\nexport function getStashLogParser(includeFiles: true): StashLogParserWithFiles;\nexport function getStashLogParser(includeFiles?: boolean): StashLogParser | StashLogParserWithFiles;\nexport function getStashLogParser(includeFiles?: boolean): StashLogParser | StashLogParserWithFiles {\n\tif (includeFiles) {\n\t\t_stashParserWithFiles ??= createLogParserWithFilesAndStats(stashMapping);\n\t\treturn _stashParserWithFiles;\n\t}\n\n\t_stashParser ??= createLogParser(stashMapping);\n\treturn _stashParser;\n}\n\ntype StashFilesOnlyLogParser = LogParserWithFilesAndStats<void>;\nlet _stashFilesOnlyParser: StashFilesOnlyLogParser | undefined;\n\nexport function getStashFilesOnlyLogParser(): StashFilesOnlyLogParser {\n\t_stashFilesOnlyParser ??= createLogParserWithFilesAndStats();\n\treturn _stashFilesOnlyParser;\n}\n\n// Parser types\nexport type Parser<T> = {\n\targuments: string[];\n\tseparators: { record: string; field: string };\n\tparse: (data: string | Iterable<string> | undefined) => Generator<T> | Iterable<T>;\n\tparseAsync?: never;\n};\nexport type AsyncParser<T> = {\n\targuments: string[];\n\tseparators: { record: string; field: string };\n\tparse: (data: string | Iterable<string> | undefined) => Generator<T> | Iterable<T>;\n\tparseAsync: (stream: AsyncGenerator<string>) => AsyncGenerator<T>;\n\t/**\n\t * Like `parseAsync` but yields one ARRAY of entries per stream chunk, scanning each chunk\n\t * synchronously with plain `indexOf` (no per-field iterator machinery). Bulk consumers (the\n\t * graph walk) avoid two promise hops per record — thousands of awaited yields collapse to one\n\t * per chunk. Only the plain parser implements it; per-record `parseAsync` remains the\n\t * general-purpose path.\n\t */\n\tparseAsyncBatched?: (stream: AsyncGenerator<string>) => AsyncGenerator<T[]>;\n};\n\nexport type LogParser<T> = AsyncParser<LogParsedEntry<T>>;\ntype LogParserWithFiles<T> = AsyncParser<LogParsedEntryWithFiles<T>>;\ntype LogParserWithFilesAndStats<T> = AsyncParser<LogParsedEntryWithFilesAndStats<T>>;\ntype LogParserWithFileSummary<T> = Parser<LogParsedEntryWithFiles<T>>;\ntype LogParserWithStats<T> = AsyncParser<LogParsedEntryWithStats<T>>;\n\n// Parsed entry types\ntype LogParsedEntry<T> = { [K in keyof T]: string } & { files?: never; stats?: never };\ntype LogParsedEntryWithFiles<T> = { [K in keyof T]: string } & { files: LogParsedFile[]; stats?: never };\ntype LogParsedEntryWithFilesAndStats<T> = { [K in keyof T]: string } & {\n\tfiles: LogParsedFileWithStats[];\n\tstats: LogParsedStatsWithFilesStats;\n};\ntype LogParsedEntryWithStats<T> = { [K in keyof T]: string } & { stats: LogParsedStats };\n\n// Parsed types\nexport interface LogParsedFile {\n\tstatus?: string;\n\tpath: string;\n\toriginalPath?: string;\n\tadditions?: never;\n\tdeletions?: never;\n\trange?: LogParsedRange;\n\toriginalRange?: LogParsedRange;\n\t/** Git file mode (e.g., 100644=regular, 100755=executable, 120000=symlink, 160000=submodule) */\n\tmode?: string;\n\t/** For submodule entries (mode 160000), the commit SHA the submodule points to */\n\toid?: string;\n\t/** For submodule entries (mode 160000), the previous commit SHA */\n\tpreviousOid?: string;\n}\ntype LogParsedFileWithStats = Omit<LogParsedFile, 'additions' | 'deletions'> & {\n\tadditions: number;\n\tdeletions: number;\n};\ninterface LogParsedRange {\n\tstartLine: number;\n\tendLine: number;\n}\ninterface LogParsedStats {\n\tfiles: number;\n\tadditions: number;\n\tdeletions: number;\n}\ninterface LogParsedStatsWithFilesStats {\n\tfiles: { added: number; changed: number; deleted: number };\n\tadditions: number;\n\tdeletions: number;\n}\n\n// KEEP: assumes no `-z` output: a NUL path terminator followed by 0x1E/0x1D would form a sentinel\n// SEE: `git commit -F` with a NUL fails \"a NUL byte in commit log message not allowed.\" (git 2.44.0)\nconst recordSep = '\\0\\x1E';\nconst recordFormatSep = '%x00%x1E';\nconst fieldSep = '\\0\\x1D';\nconst fieldFormatSep = '%x00%x1D';\n\nfunction indexOfSeparator(s: string, separator: string, from: number): number {\n\tconst marker = separator[1];\n\tlet index = s.indexOf(marker, from + 1);\n\twhile (index !== -1 && s.charCodeAt(index - 1) !== 0) {\n\t\tindex = s.indexOf(marker, index + 1);\n\t}\n\treturn index === -1 ? -1 : index - 1;\n}\n\nconst flattenSourceThreshold = 128 * 1024;\n\nfunction readFields<K extends PropertyKey>(record: string, keys: readonly K[], entry: Record<K, string>): number {\n\tlet start = 0;\n\tfor (const key of keys) {\n\t\tconst end = indexOfSeparator(record, fieldSep, start);\n\t\tif (end === -1) return -1;\n\n\t\tentry[key] = record.substring(start, end);\n\t\tstart = end + fieldSep.length;\n\t}\n\treturn start;\n}\n\nfunction getPayload(record: string, start: number): string {\n\tif (record.charCodeAt(start) === 10) {\n\t\tstart++;\n\t\tif (record.charCodeAt(start) === 10) {\n\t\t\tstart++;\n\t\t}\n\t}\n\n\tconst end = indexOfSeparator(record, fieldSep, start);\n\treturn record.substring(start, end === -1 ? record.length : end);\n}\n\nclass RecordScanner {\n\t// KEEP: never push '' to `pieces`: joining one string with '' returns it (maybe a slice), pinning its chunk\n\t// SEE: https://github.com/v8/v8/blob/main/src/builtins/array-join.tq (BufferJoin single-element fast path)\n\tprivate readonly pieces: string[] = [];\n\tprivate chunk = '';\n\tprivate start = 0;\n\tprivate from = 0;\n\n\tconstructor(private readonly copy = false) {}\n\n\tpush(chunk: string): void {\n\t\tif (this.start < this.chunk.length) {\n\t\t\tthis.pieces.push(this.start === 0 ? this.chunk : this.chunk.substring(this.start));\n\t\t}\n\n\t\tthis.chunk = chunk;\n\t\tthis.start = 0;\n\t\tthis.from = 0;\n\t}\n\n\tnext(): string | undefined {\n\t\tif (this.from === 0 && this.pieces.length !== 0 && this.chunk.charCodeAt(0) === recordSep.charCodeAt(1)) {\n\t\t\tconst last = this.pieces.length - 1;\n\t\t\tconst piece = this.pieces[last];\n\t\t\tif (piece.charCodeAt(piece.length - 1) === 0) {\n\t\t\t\tif (piece.length === 1) {\n\t\t\t\t\tthis.pieces.pop();\n\t\t\t\t} else {\n\t\t\t\t\tthis.pieces[last] = piece.substring(0, piece.length - 1);\n\t\t\t\t}\n\n\t\t\t\tthis.start = this.from = 1;\n\t\t\t\treturn this.complete('');\n\t\t\t}\n\t\t}\n\n\t\tconst end = indexOfSeparator(this.chunk, recordSep, this.from);\n\t\tif (end === -1) {\n\t\t\tthis.from = this.chunk.length;\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst record = this.complete(this.chunk.substring(this.start, end));\n\t\tthis.start = this.from = end + recordSep.length;\n\t\treturn record;\n\t}\n\n\tend(): string {\n\t\tconst record = this.complete(this.chunk.substring(this.start));\n\t\tthis.chunk = '';\n\t\tthis.start = this.from = 0;\n\t\treturn record;\n\t}\n\n\tprivate complete(text: string): string {\n\t\tif (text.length) {\n\t\t\tthis.pieces.push(text);\n\t\t}\n\n\t\tlet record: string;\n\t\tif (this.pieces.length > 1) {\n\t\t\trecord = this.pieces.join('');\n\t\t} else {\n\t\t\trecord = this.pieces[0] ?? '';\n\t\t\tif (this.copy) {\n\t\t\t\trecord = flattenString(record, 1);\n\t\t\t}\n\t\t}\n\n\t\tthis.pieces.length = 0;\n\t\treturn record;\n\t}\n}\n\nfunction createRecordParsers<E>(\n\tscope: string,\n\tparseRecord: (record: string) => E | undefined,\n): Pick<AsyncParser<E>, 'parse' | 'parseAsync'> {\n\tconst parseScope = `${scope}.parse`;\n\tconst parseAsyncScope = `${scope}.parseAsync`;\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<E> {\n\t\tusing sw = maybeStopWatch(parseScope, { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst scanner = new RecordScanner(typeof data === 'string' && data.length > flattenSourceThreshold);\n\n\t\tlet count = 0;\n\t\tlet dropped = 0;\n\t\tlet entry: E | undefined;\n\n\t\tfor (const chunk of typeof data === 'string' ? [data] : data) {\n\t\t\tscanner.push(chunk);\n\n\t\t\tfor (let record = scanner.next(); record != null; record = scanner.next()) {\n\t\t\t\tif (!record.length) continue;\n\n\t\t\t\tentry = parseRecord(record);\n\t\t\t\tif (entry == null) {\n\t\t\t\t\tdropped++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcount++;\n\t\t\t\tyield entry;\n\t\t\t}\n\t\t}\n\n\t\tconst tail = scanner.end();\n\t\tif (tail.length) {\n\t\t\tentry = parseRecord(tail);\n\t\t\tif (entry == null) {\n\t\t\t\tdropped++;\n\t\t\t} else {\n\t\t\t\tcount++;\n\t\t\t\tyield entry;\n\t\t\t}\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records${dropped > 0 ? `, dropped ${dropped}` : ''}` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<E> {\n\t\tusing sw = maybeStopWatch(parseAsyncScope, { log: { onlyExit: true, level: 'debug' } });\n\n\t\tconst scanner = new RecordScanner(true);\n\n\t\tlet count = 0;\n\t\tlet dropped = 0;\n\t\tlet entry: E | undefined;\n\n\t\t// KEEP: no `for await` and never close or await the caller's stream: git's stream cleanup waits for git to exit\n\t\tfor (let result = await stream.next(); !result.done; result = await stream.next()) {\n\t\t\tscanner.push(result.value);\n\n\t\t\tfor (let record = scanner.next(); record != null; record = scanner.next()) {\n\t\t\t\tif (!record.length) continue;\n\n\t\t\t\tentry = parseRecord(record);\n\t\t\t\tif (entry == null) {\n\t\t\t\t\tdropped++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcount++;\n\t\t\t\tyield entry;\n\t\t\t}\n\t\t}\n\n\t\tconst tail = scanner.end();\n\t\tif (tail.length) {\n\t\t\tentry = parseRecord(tail);\n\t\t\tif (entry == null) {\n\t\t\t\tdropped++;\n\t\t\t} else {\n\t\t\t\tcount++;\n\t\t\t\tyield entry;\n\t\t\t}\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records${dropped > 0 ? `, dropped ${dropped}` : ''}` });\n\t}\n\n\treturn { parse: parse, parseAsync: parseAsync };\n}\n\nexport function createLogParser<T extends Record<string, string>>(mapping: ExtractAll<T, string>): LogParser<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`];\n\n\tfunction parseRecord(record: string): LogParsedEntry<T> | undefined {\n\t\tconst entry = {} as unknown as LogParsedEntry<T>;\n\t\treturn readFields(record, keys, entry) === -1 ? undefined : entry;\n\t}\n\n\tasync function* parseAsyncBatched(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntry<T>[]> {\n\t\tusing sw = maybeStopWatch('Git.LogParser.parseAsyncBatched', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tconst scanner = new RecordScanner(true);\n\n\t\tlet count = 0;\n\t\tlet dropped = 0;\n\t\tlet entry: LogParsedEntry<T> | undefined;\n\n\t\tfor await (const chunk of stream) {\n\t\t\tscanner.push(chunk);\n\n\t\t\tlet batch: LogParsedEntry<T>[] | undefined;\n\t\t\tfor (let record = scanner.next(); record != null; record = scanner.next()) {\n\t\t\t\tif (!record.length) continue;\n\n\t\t\t\tentry = parseRecord(record);\n\t\t\t\tif (entry == null) {\n\t\t\t\t\tdropped++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t(batch ??= []).push(entry);\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (batch != null) {\n\t\t\t\tyield batch;\n\t\t\t}\n\t\t}\n\n\t\tconst tail = scanner.end();\n\t\tif (tail.length) {\n\t\t\tentry = parseRecord(tail);\n\t\t\tif (entry == null) {\n\t\t\t\tdropped++;\n\t\t\t} else {\n\t\t\t\tcount++;\n\t\t\t\tyield [entry];\n\t\t\t}\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records${dropped > 0 ? `, dropped ${dropped}` : ''}` });\n\t}\n\n\tconst { parse, parseAsync } = createRecordParsers('Git.LogParser', parseRecord);\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t\tparseAsyncBatched: parseAsyncBatched,\n\t};\n}\n\nfunction createLogParserWithFilesAndStats(): LogParserWithFilesAndStats<void>;\nfunction createLogParserWithFilesAndStats<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFilesAndStats<T>;\nfunction createLogParserWithFilesAndStats<T extends Record<string, string> | void>(\n\tmapping?: ExtractAll<T, string>,\n): LogParserWithFilesAndStats<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tif (mapping != null) {\n\t\tfor (const key in mapping) {\n\t\t\tkeys.push(key);\n\t\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t\t}\n\t}\n\t// Use --raw instead of --summary to get accurate mode info for ALL files (not just creates/deletes)\n\t// This allows us to reliably detect submodules (mode 160000) even for modifications\n\tconst args = [`--format=${format}`, '--numstat', '--raw'];\n\n\tfunction parseFilesAndStats(content: string): LogParsedFileWithStats[] {\n\t\tconst files: LogParsedFileWithStats[] = [];\n\t\tif (!content?.length) return files;\n\n\t\t// Map to store info from --raw lines: path -> { mode, status, originalPath, oid?, previousOid? }\n\t\t// Raw format: :<old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\\t<path>[\\t<new_path>]\n\t\tconst infoMap = new Map<\n\t\t\tstring,\n\t\t\t{ mode: string; status: string; originalPath?: string; oid?: string; previousOid?: string }\n\t\t>();\n\n\t\tlet startIndex: number;\n\t\tlet endIndex: number;\n\n\t\t// Single pass: --raw lines come first, then --numstat lines\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tif (!line) continue;\n\n\t\t\tif (line.charCodeAt(0) === 58 /* ':' */) {\n\t\t\t\t// --raw format: :<old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\\t<path>[\\t<new_path>]\n\t\t\t\tconst tabIndex = line.indexOf('\\t');\n\t\t\t\tif (tabIndex === -1) continue;\n\n\t\t\t\t// Parse metadata using indexOf instead of split() to avoid array allocation\n\t\t\t\t// Format after ':': <old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\n\n\t\t\t\t// Skip old_mode, find new_mode\n\t\t\t\tstartIndex = line.indexOf(' ') + 1;\n\t\t\t\tif (startIndex === 0) continue;\n\n\t\t\t\tendIndex = line.indexOf(' ', startIndex);\n\t\t\t\tif (endIndex === -1) continue;\n\n\t\t\t\tconst newMode = line.substring(startIndex, endIndex);\n\n\t\t\t\t// Parse old_sha and new_sha positions\n\t\t\t\tconst oldShaStart = endIndex + 1;\n\t\t\t\tconst oldShaEnd = line.indexOf(' ', oldShaStart);\n\t\t\t\tif (oldShaEnd === -1) continue;\n\n\t\t\t\tconst newShaStart = oldShaEnd + 1;\n\t\t\t\tconst newShaEnd = line.indexOf(' ', newShaStart);\n\t\t\t\tif (newShaEnd === -1) continue;\n\n\t\t\t\t// For submodules (mode 160000), capture the commit SHAs\n\t\t\t\tlet oid: string | undefined;\n\t\t\t\tlet previousOid: string | undefined;\n\t\t\t\tif (newMode === '160000') {\n\t\t\t\t\tpreviousOid = line.substring(oldShaStart, oldShaEnd);\n\t\t\t\t\toid = line.substring(newShaStart, newShaEnd);\n\t\t\t\t}\n\n\t\t\t\t// Status is first char after the last space\n\t\t\t\tstartIndex = newShaEnd;\n\t\t\t\tconst status = line.charAt(startIndex + 1);\n\n\t\t\t\t// Parse path(s) using indexOf instead of split\n\t\t\t\tconst pathPart = line.substring(tabIndex + 1);\n\t\t\t\tlet path: string;\n\t\t\t\tlet originalPath: string | undefined;\n\n\t\t\t\t// Each field is trimmed as written, to match parseCopyOrRename, which trims an unquoted name. A\n\t\t\t\t// quoted name's whitespace is inside its quotes, so it is part of the name and kept\n\t\t\t\tconst pathTabIndex = pathPart.indexOf('\\t');\n\t\t\t\tif ((status === 'R' || status === 'C') && pathTabIndex !== -1) {\n\t\t\t\t\t// For renames/copies: old_path\\tnew_path\n\t\t\t\t\toriginalPath = unquoteCString(pathPart.substring(0, pathTabIndex).trim());\n\t\t\t\t\tpath = unquoteCString(pathPart.substring(pathTabIndex + 1).trim());\n\t\t\t\t} else {\n\t\t\t\t\tpath = unquoteCString(pathPart.trim());\n\t\t\t\t}\n\n\t\t\t\tinfoMap.set(path, {\n\t\t\t\t\tmode: newMode,\n\t\t\t\t\tstatus: status,\n\t\t\t\t\toriginalPath: originalPath,\n\t\t\t\t\toid: oid,\n\t\t\t\t\tpreviousOid: previousOid,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// --numstat format: <additions>\\t<deletions>\\t<path>\n\t\t\t\t// With renames: <additions>\\t<deletions>\\t{prefix/old => new/suffix}\n\t\t\t\tendIndex = line.indexOf('\\t');\n\t\t\t\tif (endIndex === -1) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst additions = line.substring(0, endIndex);\n\n\t\t\t\tstartIndex = endIndex + 1;\n\t\t\t\tendIndex = line.indexOf('\\t', startIndex);\n\t\t\t\tif (endIndex === -1) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst deletions = line.substring(startIndex, endIndex);\n\n\t\t\t\tlet path = line.substring(endIndex + 1);\n\t\t\t\tlet originalPath: string | undefined;\n\n\t\t\t\t// Parse rename format from numstat (e.g., \"{old => new}/path\"), which comes back trimmed as --raw's is\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(path, false));\n\n\t\t\t\t// Look up --raw info for this path (keyed by the new/destination path)\n\t\t\t\tconst info = infoMap.get(path);\n\n\t\t\t\t// Use status from --raw if available; provides accurate status (A/D/M/R/C/T)\n\t\t\t\tconst status = info?.status ?? (originalPath ? 'R' : 'M');\n\n\t\t\t\t// Use originalPath from --raw if available (cleaner than numstat format)\n\t\t\t\tif (info?.originalPath) {\n\t\t\t\t\toriginalPath = info.originalPath;\n\t\t\t\t}\n\n\t\t\t\tconst file: LogParsedFileWithStats = {\n\t\t\t\t\tstatus: status,\n\t\t\t\t\tpath: path,\n\t\t\t\t\toriginalPath: originalPath,\n\t\t\t\t\tadditions: additions === '-' ? 0 : parseInt(additions, 10) || 0,\n\t\t\t\t\tdeletions: deletions === '-' ? 0 : parseInt(deletions, 10) || 0,\n\t\t\t\t\t// Store mode for consumers to derive file type (160000=submodule, 100755=executable, etc.)\n\t\t\t\t\tmode: info?.mode,\n\t\t\t\t\toid: info?.oid,\n\t\t\t\t\tpreviousOid: info?.previousOid,\n\t\t\t\t};\n\n\t\t\t\tfiles.push(file);\n\t\t\t}\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction parseRecord(record: string): LogParsedEntryWithFilesAndStats<T> | undefined {\n\t\tconst entry = {} as unknown as LogParsedEntryWithFilesAndStats<T>;\n\t\tconst payloadStart = readFields(record, keys, entry);\n\t\tif (payloadStart === -1) return undefined;\n\n\t\tconst files = parseFilesAndStats(getPayload(record, payloadStart));\n\t\tentry.files = files;\n\t\tif (files.length) {\n\t\t\tentry.stats = { additions: 0, deletions: 0, files: { added: 0, deleted: 0, changed: 0 } };\n\n\t\t\tfor (const f of files) {\n\t\t\t\tif (f.additions || f.deletions) {\n\t\t\t\t\tentry.stats.additions += f.additions ?? 0;\n\t\t\t\t\tentry.stats.deletions += f.deletions ?? 0;\n\t\t\t\t\tif (f.status === 'A' || f.status === '?') {\n\t\t\t\t\t\tentry.stats.files.added++;\n\t\t\t\t\t} else if (f.status === 'D') {\n\t\t\t\t\t\tentry.stats.files.deleted++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.stats.files.changed++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn entry;\n\t}\n\n\tconst { parse, parseAsync } = createRecordParsers('Git.LogParserWithFilesAndStats', parseRecord);\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithFileSummary(): LogParserWithFileSummary<void>;\nfunction createLogParserWithFileSummary<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFileSummary<T>;\nfunction createLogParserWithFileSummary<T extends Record<string, string> | void>(\n\tmapping?: ExtractAll<T, string>,\n): LogParserWithFileSummary<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tif (mapping != null) {\n\t\tfor (const key in mapping) {\n\t\t\tkeys.push(key);\n\t\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t\t}\n\t}\n\tconst args = [`--format=${format}`, '--summary'];\n\n\tfunction parseFileSummary(content: string): LogParsedFile[] {\n\t\tconst files: LogParsedFile[] = [];\n\t\tif (!content?.length) return files;\n\n\t\tlet startIndex;\n\n\t\tlet path;\n\t\tlet originalPath;\n\t\tlet status;\n\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tif (!line) continue;\n\n\t\t\tif (line.startsWith(' rename ')) {\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(line.substring(8 /* move past ' rename ' */), true));\n\t\t\t\tfiles.push({ path: path, originalPath: originalPath, status: 'R' });\n\t\t\t} else if (line.startsWith(' copy ')) {\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(line.substring(6 /* move past ' copy ' */), true));\n\t\t\t\tfiles.push({ path: path, originalPath: originalPath, status: 'C' });\n\t\t\t} else {\n\t\t\t\tif (line.startsWith(' create mode ')) {\n\t\t\t\t\tstatus = 'A';\n\t\t\t\t} else if (line.startsWith(' delete mode ')) {\n\t\t\t\t\tstatus = 'D';\n\t\t\t\t} else {\n\t\t\t\t\t// Ignore \" mode change \" lines\n\t\t\t\t\tif (!line.startsWith(' mode change ')) {\n\t\t\t\t\t\tdebugger;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstartIndex = line.indexOf(' ', 13 /* move past 'create mode <num>' or 'delete mode <num>' */);\n\t\t\t\tif (startIndex > -1) {\n\t\t\t\t\tpath = unquoteCString(line.substring(startIndex + 1));\n\t\t\t\t\tfiles.push({ path: path, status: status });\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction parseRecord(record: string): LogParsedEntryWithFiles<T> | undefined {\n\t\tconst entry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\tconst payloadStart = readFields(record, keys, entry);\n\t\tif (payloadStart === -1) return undefined;\n\n\t\tentry.files = parseFileSummary(getPayload(record, payloadStart));\n\t\treturn entry;\n\t}\n\n\tconst { parse } = createRecordParsers('Git.LogParserWithFileSummary', parseRecord);\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t};\n}\n\n/**\n * Reads a numstat or summary name, or the two names of a rename or copy, trimmed as git wrote them: an unquoted name\n * is trimmed, while a quoted one keeps the whitespace inside its quotes\n */\nfunction parseCopyOrRename(field: string, stripPercentage: boolean): { path: string; originalPath?: string } {\n\tconst path = field.trim();\n\tif (path.includes('\"')) {\n\t\tconst quoted = parseQuotedRenameOrCopyPaths(path, stripPercentage);\n\t\tif (quoted != null) return quoted;\n\t}\n\n\tconst renameIndex = path.indexOf(' => ');\n\tif (renameIndex === -1) return { path: path };\n\n\tlet hasBraces = true;\n\n\tlet openIndex = path.indexOf('{');\n\tif (openIndex === -1) {\n\t\thasBraces = false;\n\t\topenIndex = 0;\n\t}\n\n\tlet closeIndex = path.indexOf('}', openIndex);\n\tif (closeIndex === -1) {\n\t\thasBraces = false;\n\t\tcloseIndex = path.length;\n\t}\n\n\tconst prefix = path.substring(0, openIndex);\n\tconst fromPart = path.substring(hasBraces ? openIndex + 1 : 0, renameIndex);\n\tlet toPart = path.substring(renameIndex + 4, closeIndex);\n\tlet suffix = path.substring(closeIndex + 1);\n\n\t// Check for percentage marker which always appears at the end as (xx%)\n\tif (stripPercentage) {\n\t\tif (hasBraces) {\n\t\t\tif (suffix.endsWith('%)')) {\n\t\t\t\t// Find the last open paren that starts the percentage\n\t\t\t\tconst percentPos = suffix.lastIndexOf(' (');\n\t\t\t\tif (percentPos > -1) {\n\t\t\t\t\tsuffix = suffix.substring(0, percentPos);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (toPart.endsWith('%)')) {\n\t\t\t// Find the last open paren that starts the percentage\n\t\t\tconst percentPos = toPart.lastIndexOf(' (');\n\t\t\tif (percentPos > -1) {\n\t\t\t\ttoPart = toPart.substring(0, percentPos);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tpath: normalizePath(joinPaths(prefix, toPart, suffix).trim()),\n\t\toriginalPath: normalizePath(joinPaths(prefix, fromPart, suffix).trim()),\n\t};\n}\n\nfunction createLogParserSingle(field: string): Parser<string> {\n\tconst args = ['-z', `--format=${field}`];\n\n\tfunction parse(data: string | Iterable<string> | undefined): Iterable<string> {\n\t\tusing _sw = maybeStopWatch('Git.LogParserSingle.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\treturn data ? iterateByDelimiter(data, '\\0') : [];\n\t}\n\n\treturn { arguments: args, separators: { record: '\\0', field: '\\0' }, parse: parse };\n}\n\n// TODO: a NUL+0x1E inside diff content still splits a patch record; needs scanner lookahead across chunks\nfunction createLogParserWithPatch<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFiles<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`];\n\n\tfunction parsePatch(content: string): LogParsedFile | undefined {\n\t\tconst lines = iterateByDelimiter(content, '\\n');\n\t\tlet line = lines.next();\n\t\tif (line.done) return undefined;\n\n\t\tif (!content.startsWith('diff --git ')) return undefined;\n\n\t\t// KEEP: a truncated payload's last line is partial, so a header path read from it would be cut short\n\t\tconst paths = parseDiffFilePaths(\n\t\t\tcontent.endsWith('\\n') ? content : content.substring(0, content.lastIndexOf('\\n') + 1) || content,\n\t\t);\n\t\tif (paths == null) return undefined;\n\n\t\twhile (!line.done && !line.value.startsWith('@@ ')) {\n\t\t\tline = lines.next();\n\t\t}\n\n\t\tconst rangeMatch = line.done ? undefined : line.value.match(diffHunkRegex);\n\n\t\tlet range: LogParsedRange | undefined;\n\t\tlet originalRange: LogParsedRange | undefined;\n\t\tif (rangeMatch != null) {\n\t\t\tlet start = parseInt(rangeMatch[1], 10);\n\t\t\tlet count = rangeMatch[2] ? parseInt(rangeMatch[2], 10) : 1;\n\n\t\t\toriginalRange = start && count ? { startLine: start, endLine: start + count - 1 } : undefined;\n\n\t\t\tstart = parseInt(rangeMatch[3], 10);\n\t\t\tcount = rangeMatch[4] ? parseInt(rangeMatch[4], 10) : 1;\n\n\t\t\trange = start && count ? { startLine: start, endLine: start + count - 1 } : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tstatus: 'M' satisfies GitFileIndexStatus,\n\t\t\tpath: paths.path,\n\t\t\toriginalPath: undefined,\n\t\t\trange: range,\n\t\t\toriginalRange: originalRange,\n\t\t};\n\t}\n\n\tfunction parseRecord(record: string): LogParsedEntryWithFiles<T> | undefined {\n\t\tconst entry = { files: [] } as unknown as LogParsedEntryWithFiles<T>;\n\t\tconst payloadStart = readFields(record, keys, entry);\n\t\tif (payloadStart === -1) return undefined;\n\n\t\tconst file = parsePatch(getPayload(record, payloadStart));\n\t\tif (file != null) {\n\t\t\tentry.files = [file];\n\t\t}\n\t\treturn entry;\n\t}\n\n\tconst { parse, parseAsync } = createRecordParsers('Git.LogParserWithPatch', parseRecord);\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithStats<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithStats<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`, '--shortstat'];\n\n\tfunction parseStats(content: string): LogParsedStats {\n\t\tconst stats: LogParsedStats = { files: 0, additions: 0, deletions: 0 };\n\t\tcontent = content?.trim();\n\t\tif (!content?.length) return { files: 0, additions: 0, deletions: 0 };\n\n\t\tlet filesEnd;\n\t\tlet filesIndex = content.indexOf(' files changed');\n\t\tif (filesIndex === -1) {\n\t\t\tfilesIndex = content.indexOf(' file changed');\n\t\t\tif (filesIndex === -1) return stats;\n\n\t\t\tfilesEnd = filesIndex + ' file changed'.length;\n\t\t} else {\n\t\t\tfilesEnd = filesIndex + ' files changed'.length;\n\t\t}\n\n\t\t// Extract number before \" files changed\"\n\t\tconst filesPart = content.substring(0, filesIndex).trim();\n\t\tstats.files = parseInt(filesPart, 10) || 0;\n\n\t\t// Extract additions if present\n\t\tconst additionsIndex = content.indexOf(' insertion', filesEnd);\n\t\tif (additionsIndex !== -1) {\n\t\t\t// Look for the number before \"insertion(+)\" or \"insertions(+)\"\n\t\t\tconst spaceIndex = content.lastIndexOf(' ', additionsIndex - 1);\n\t\t\tif (spaceIndex !== -1) {\n\t\t\t\tconst additionsPart = content.substring(spaceIndex, additionsIndex).trim();\n\t\t\t\tstats.additions = parseInt(additionsPart, 10) || 0;\n\t\t\t}\n\t\t}\n\n\t\t// Extract deletions if present\n\t\tconst deletionsIndex = content.indexOf(' deletion', filesEnd);\n\t\tif (deletionsIndex !== -1) {\n\t\t\t// Look for the number before \"\"deletion(-)\" or \"deletions(-)\"\n\t\t\tconst spaceIndex = content.lastIndexOf(' ', deletionsIndex - 1);\n\t\t\tif (spaceIndex !== -1) {\n\t\t\t\tconst deletionsPart = content.substring(spaceIndex, deletionsIndex).trim();\n\t\t\t\tstats.deletions = parseInt(deletionsPart, 10) || 0;\n\t\t\t}\n\t\t}\n\n\t\treturn stats;\n\t}\n\n\tfunction parseRecord(record: string): LogParsedEntryWithStats<T> | undefined {\n\t\tconst entry = { stats: { files: 0, additions: 0, deletions: 0 } } as unknown as LogParsedEntryWithStats<T>;\n\t\tconst payloadStart = readFields(record, keys, entry);\n\t\tif (payloadStart === -1) return undefined;\n\n\t\tconst payload = getPayload(record, payloadStart);\n\t\tif (payload.length) {\n\t\t\tentry.stats = parseStats(payload);\n\t\t}\n\t\treturn entry;\n\t}\n\n\tconst { parse, parseAsync } = createRecordParsers('Git.LogParserWithStats', parseRecord);\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithFiles<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFiles<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`, '--name-only'];\n\n\tfunction parseFileNames(content: string): LogParsedFile[] {\n\t\tconst files: LogParsedFile[] = [];\n\t\tif (!content?.length) return files;\n\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tconst trimmed = line.trim();\n\t\t\tif (!trimmed) continue;\n\n\t\t\tfiles.push({ path: unquoteCString(trimmed) });\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction parseRecord(record: string): LogParsedEntryWithFiles<T> | undefined {\n\t\tconst entry = { files: [] } as unknown as LogParsedEntryWithFiles<T>;\n\t\tconst payloadStart = readFields(record, keys, entry);\n\t\tif (payloadStart === -1) return undefined;\n\n\t\tentry.files = parseFileNames(getPayload(record, payloadStart));\n\t\treturn entry;\n\t}\n\n\tconst { parse, parseAsync } = createRecordParsers('Git.createLogParserWithFiles', parseRecord);\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n"],"mappings":";;;;;;AAOA,MAAM,iBAAiB;CACtB,KAAK;CACL,QAAQ;CACR,aAAa;CACb,YAAY;CACZ,WAAW;CACX,gBAAgB;CAChB,eAAe;CACf,SAAS;CACT,MAAM;CACN,SAAS;AACV;AAGA,IAAI;AAEJ,IAAI;AAEJ,IAAI;AAOJ,SAAgB,oBACf,cACA,aAC6E;CAC7E,IAAI,aAAa;EAChB,8BAA8B,yBAAyB,cAAc;EACrE,OAAO;CACR;CAEA,IAAI,cAAc;EACjB,4BAA4B,iCAAiC,cAAc;EAC3E,OAAO;CACR;CAEA,mBAAmB,gBAAgB,cAAc;CACjD,OAAO;AACR;AAEA,MAAM,sBAAsB;CAAE,KAAK;CAAM,QAAQ;CAAO,OAAO;CAAO,MAAM;CAAO,SAAS;AAAK;AAGjG,IAAI;AAEJ,IAAI;AAEJ,SAAgB,yBAAyB,OAAyE;CACjH,IAAI,OAAO;EACV,iCAAiC,yBAAyB,mBAAmB;EAC7E,OAAO;CACR;CAEA,wBAAwB,gBAAgB,mBAAmB;CAC3D,OAAO;AACR;AAEA,MAAM,eAAe;CACpB,KAAK;CACL,QAAQ;CACR,aAAa;CACb,YAAY;CACZ,eAAe;CACf,SAAS;CACT,MAAM;CACN,SAAS;AACV;AAGA,IAAI;AAEJ,IAAI;;;;;AAMJ,SAAgB,eAAe,OAA2D;CACzF,IAAI,OAAO;EACV,IAAI,yBAAyB,MAAM;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0BAA0B,WAAW;CAEvF,OAAO;EACN,WAAW;EACX,YAAY;GAAE,QAAQ;GAAW,OAAO;EAAS;EAC1C;EACK;CACb;AACD;AAEA,SAAS,yBACR,SACwB;CACxB,IAAI,SAAS;CACb,MAAM,OAAwC,CAAC;CAC/C,KAAK,MAAM,OAAO,SAAS;EAC1B,KAAK,KAAK,GAAG;EACb,UAAU,GAAG,QAAQ,OAAO;CAC7B;CAEA,MAAM,OAAO,CAAC,YAAY,UAAU,aAAa;CAEjD,SAAS,eAAe,SAAkC;EACzD,MAAM,QAAyB,CAAC;EAChC,IAAI,CAAC,SAAS,QAAQ,OAAO;EAE7B,KAAK,MAAM,QAAQ,mBAAmB,SAAS,IAAI,GAAG;GACrD,MAAM,UAAU,KAAK,KAAK;GAC1B,IAAI,CAAC,SAAS;GAEd,MAAM,KAAK,EAAE,MAAM,eAAe,OAAO,EAAE,CAAC;EAC7C;EAEA,OAAO;CACR;CAEA,SAAS,YAAY,QAAwD;EAC5E,MAAM,QAAQ,EAAE,OAAO,CAAC,EAAE;EAC1B,MAAM,eAAe,WAAW,QAAQ,MAAM,KAAK;EACnD,IAAI,iBAAiB,IAAI,OAAO,KAAA;EAEhC,MAAM,QAAQ,eAAe,WAAW,QAAQ,YAAY,CAAC;EAC7D,OAAO;CACR;CAEA,MAAM,EAAE,OAAO,eAAe,oBAAoB,gCAAgC,WAAW;CAE7F,OAAO;EACN,WAAW;EACX,YAAY;GAAE,QAAQ;GAAW,OAAO;EAAS;EAC1C;EACK;CACb;AACD"}
@@ -43,10 +43,10 @@ function getRefParser(supportedFeatures) {
43
43
  _refParser ??= createRefParser(refMapping);
44
44
  return _refParser;
45
45
  }
46
- const recordSep = "";
47
- const recordFormatSep = "%1E";
48
- const fieldSep = "";
49
- const fieldFormatSep = "%1D";
46
+ const recordSep = "\0";
47
+ const recordFormatSep = "%00%1E";
48
+ const fieldSep = "\0";
49
+ const fieldFormatSep = "%00%1D";
50
50
  function createRefParser(mapping) {
51
51
  let format = recordFormatSep;
52
52
  const keys = [];
@@ -1 +1 @@
1
- {"version":3,"file":"refParser.js","names":[],"sources":["../../../../git-cli/src/parsers/refParser.ts"],"sourcesContent":["import type { FilteredGitFeatures } from '@gitlens/git/features.js';\nimport type { RefRecord } from '@gitlens/git/models/reference.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { ExtractAll } from '@gitlens/utils/types.js';\nimport type { Parser } from './logParser.js';\n\n/**\n * Unified `for-each-ref` mapping covering branches, remotes, and tags in a single pass.\n * Fields inapplicable to a given ref-type come back as empty strings from git.\n *\n * NOTE: When adding a new field that is gated on a git feature flag, mirror the entry in\n * `refMappingSupportsWorktreePath` (and any future variants) — both maps MUST stay aligned\n * so callers can switch parsers based on `git.supported('git:for-each-ref')` without losing\n * field positions.\n */\nconst refMapping = {\n\tcurrent: `%(HEAD)`,\n\tname: `%(refname)`,\n\tobjectname: `%(objectname)`,\n\tpeeledObjectname: `%(*objectname)`,\n\tupstream: `%(upstream)`,\n\tupstreamTracking: `%(upstream:track)`,\n\tcommitterDate: `%(committerdate:iso8601)`,\n\tcreatorDate: `%(creatordate:iso8601)`,\n\tauthorDate: `%(authordate:iso8601)`,\n\tsubject: `%(subject)`,\n\tworktreePath: undefined,\n\tupstreamRemote: undefined,\n\tupstreamRemoteRef: undefined,\n\t// Last, so the feature-gated fields above keep their positions in both mappings\n\tpush: `%(push)`,\n};\n\nconst refMappingSupportsWorktreePath = {\n\t...refMapping,\n\tworktreePath: '%(worktreepath)',\n\t// `%(upstream:remotename)` and `%(upstream:remoteref)` need git 2.16, which the 2.23 `worktreePath` gate already implies\n\tupstreamRemote: '%(upstream:remotename)',\n\tupstreamRemoteRef: '%(upstream:remoteref)',\n};\n\ntype RefParser = Parser<RefRecord>;\n\nlet _refParser: RefParser | undefined;\nlet _refParserWithWorktree: RefParser | undefined;\n\nexport function getRefParser(supportedFeatures: FilteredGitFeatures<'git:for-each-ref'>[]): RefParser {\n\tif (supportedFeatures.includes('git:for-each-ref:worktreePath')) {\n\t\t_refParserWithWorktree ??= createRefParser(refMappingSupportsWorktreePath);\n\t\treturn _refParserWithWorktree;\n\t}\n\n\t_refParser ??= createRefParser(refMapping);\n\treturn _refParser;\n}\n\nconst recordSep = '\\x1E'; // ASCII Record Separator character\nconst recordFormatSep = '%1E';\nconst fieldSep = '\\x1D'; // ASCII Group Separator character\nconst fieldFormatSep = '%1D';\n\nfunction createRefParser<T extends Record<string, string | undefined>>(\n\tmapping: ExtractAll<T, string | undefined>,\n): Parser<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tconst value = mapping[key];\n\t\tif (!value) continue;\n\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`];\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<T> {\n\t\tusing sw = maybeStopWatch('Git.RefParser.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: T;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as T;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\t\t\t\tif (fieldCount >= keys.length) continue; // Handle extra newlines at the end\n\n\t\t\t\tentry[keys[fieldCount++]] = field.value as T[keyof T];\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\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,CAAC;IACT,SAAS,mBAAmB,QAAQ,QAAQ;IAE5C,IAAI,aAAa;IACjB,IAAI;IAEJ,OAAO,MAAM;KACZ,QAAQ,OAAO,KAAK;KACpB,IAAI,MAAM,MAAM;KAChB,IAAI,cAAc,KAAK,QAAQ;KAE/B,MAAM,KAAK,iBAAiB,MAAM;IACnC;IAEA,MAAM;GACP;GAEA,IAAI,KAAK,EAAE,QAAQ,WAAW,MAAM,UAAU,CAAC;;;;;;CAChD;CAEA,OAAO;EAAE,WAAW;EAAM,YAAY;GAAE,QAAQ;GAAW,OAAO;EAAS;EAAU;CAAM;AAC5F"}
1
+ {"version":3,"file":"refParser.js","names":[],"sources":["../../../../git-cli/src/parsers/refParser.ts"],"sourcesContent":["import type { FilteredGitFeatures } from '@gitlens/git/features.js';\nimport type { RefRecord } from '@gitlens/git/models/reference.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { ExtractAll } from '@gitlens/utils/types.js';\nimport type { Parser } from './logParser.js';\n\n/**\n * Unified `for-each-ref` mapping covering branches, remotes, and tags in a single pass.\n * Fields inapplicable to a given ref-type come back as empty strings from git.\n *\n * NOTE: When adding a new field that is gated on a git feature flag, mirror the entry in\n * `refMappingSupportsWorktreePath` (and any future variants) — both maps MUST stay aligned\n * so callers can switch parsers based on `git.supported('git:for-each-ref')` without losing\n * field positions.\n */\nconst refMapping = {\n\tcurrent: `%(HEAD)`,\n\tname: `%(refname)`,\n\tobjectname: `%(objectname)`,\n\tpeeledObjectname: `%(*objectname)`,\n\tupstream: `%(upstream)`,\n\tupstreamTracking: `%(upstream:track)`,\n\tcommitterDate: `%(committerdate:iso8601)`,\n\tcreatorDate: `%(creatordate:iso8601)`,\n\tauthorDate: `%(authordate:iso8601)`,\n\tsubject: `%(subject)`,\n\tworktreePath: undefined,\n\tupstreamRemote: undefined,\n\tupstreamRemoteRef: undefined,\n\t// Last, so the feature-gated fields above keep their positions in both mappings\n\tpush: `%(push)`,\n};\n\nconst refMappingSupportsWorktreePath = {\n\t...refMapping,\n\tworktreePath: '%(worktreepath)',\n\t// `%(upstream:remotename)` and `%(upstream:remoteref)` need git 2.16, which the 2.23 `worktreePath` gate already implies\n\tupstreamRemote: '%(upstream:remotename)',\n\tupstreamRemoteRef: '%(upstream:remoteref)',\n};\n\ntype RefParser = Parser<RefRecord>;\n\nlet _refParser: RefParser | undefined;\nlet _refParserWithWorktree: RefParser | undefined;\n\nexport function getRefParser(supportedFeatures: FilteredGitFeatures<'git:for-each-ref'>[]): RefParser {\n\tif (supportedFeatures.includes('git:for-each-ref:worktreePath')) {\n\t\t_refParserWithWorktree ??= createRefParser(refMappingSupportsWorktreePath);\n\t\treturn _refParserWithWorktree;\n\t}\n\n\t_refParser ??= createRefParser(refMapping);\n\treturn _refParser;\n}\n\n// KEEP: assumes no `-z` output: a NUL terminator followed by 0x1E/0x1D would form a sentinel\nconst recordSep = '\\0\\x1E';\nconst recordFormatSep = '%00%1E';\nconst fieldSep = '\\0\\x1D';\nconst fieldFormatSep = '%00%1D';\n\nfunction createRefParser<T extends Record<string, string | undefined>>(\n\tmapping: ExtractAll<T, string | undefined>,\n): Parser<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tconst value = mapping[key];\n\t\tif (!value) continue;\n\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`];\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<T> {\n\t\tusing sw = maybeStopWatch('Git.RefParser.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: T;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as T;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\t\t\t\tif (fieldCount >= keys.length) continue; // Handle extra newlines at the end\n\n\t\t\t\tentry[keys[fieldCount++]] = field.value as T[keyof T];\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn { arguments: args, separators: { record: recordSep, field: fieldSep }, parse: parse };\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,aAAa;CAClB,SAAS;CACT,MAAM;CACN,YAAY;CACZ,kBAAkB;CAClB,UAAU;CACV,kBAAkB;CAClB,eAAe;CACf,aAAa;CACb,YAAY;CACZ,SAAS;CACT,cAAc,KAAA;CACd,gBAAgB,KAAA;CAChB,mBAAmB,KAAA;CAEnB,MAAM;AACP;AAEA,MAAM,iCAAiC;CACtC,GAAG;CACH,cAAc;CAEd,gBAAgB;CAChB,mBAAmB;AACpB;AAIA,IAAI;AACJ,IAAI;AAEJ,SAAgB,aAAa,mBAAyE;CACrG,IAAI,kBAAkB,SAAS,+BAA+B,GAAG;EAChE,2BAA2B,gBAAgB,8BAA8B;EACzE,OAAO;CACR;CAEA,eAAe,gBAAgB,UAAU;CACzC,OAAO;AACR;AAGA,MAAM,YAAY;AAClB,MAAM,kBAAkB;AACxB,MAAM,WAAW;AACjB,MAAM,iBAAiB;AAEvB,SAAS,gBACR,SACY;CACZ,IAAI,SAAS;CACb,MAAM,OAAwC,CAAC;CAC/C,KAAK,MAAM,OAAO,SAAS;EAE1B,IAAI,CADU,QAAQ,MACV;EAEZ,KAAK,KAAK,GAAG;EACb,UAAU,GAAG,QAAQ,OAAO;CAC7B;CAEA,MAAM,OAAO,CAAC,YAAY,QAAQ;CAElC,UAAU,MAAM,MAA2D;;;GAC1E,MAAM,KAAA,YAAA,EAAK,eAAe,uBAAuB,EAAE,KAAK;IAAE,UAAU;IAAM,OAAO;GAAQ,EAAE,CAAC,CAAA;GAE5F,IAAI,CAAC,MAAM;IACV,IAAI,KAAK,EAAE,QAAQ,WAAW,CAAC;IAC/B;GACD;GAEA,MAAM,UAAU,mBAAmB,MAAM,SAAS;GAElD,IAAI,QAAQ;GACZ,IAAI;GACJ,IAAI;GAEJ,KAAK,MAAM,UAAU,SAAS;IAC7B,IAAI,CAAC,OAAO,QAAQ;IAEpB;IACA,QAAQ,CAAC;IACT,SAAS,mBAAmB,QAAQ,QAAQ;IAE5C,IAAI,aAAa;IACjB,IAAI;IAEJ,OAAO,MAAM;KACZ,QAAQ,OAAO,KAAK;KACpB,IAAI,MAAM,MAAM;KAChB,IAAI,cAAc,KAAK,QAAQ;KAE/B,MAAM,KAAK,iBAAiB,MAAM;IACnC;IAEA,MAAM;GACP;GAEA,IAAI,KAAK,EAAE,QAAQ,WAAW,MAAM,UAAU,CAAC;;;;;;CAChD;CAEA,OAAO;EAAE,WAAW;EAAM,YAAY;GAAE,QAAQ;GAAW,OAAO;EAAS;EAAU;CAAM;AAC5F"}
@@ -186,6 +186,11 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
186
186
  private cleanupDeletedBranchMetadata;
187
187
  deleteRemoteBranch(repoPath: string, names: string | string[], remote: string): Promise<void>;
188
188
  getBranchMergedStatus(repoPath: string, branch: GitBranchReference, into: GitBranchReference, cancellation?: AbortSignal): Promise<GitBranchMergedStatus>;
189
+ /**
190
+ * Whether `branch` is merged into `into`, cached per pair. `into` and its local counterpart are cached apart, so a
191
+ * move of one (a fetch moving the remote target) doesn't recheck the other.
192
+ */
193
+ private getCachedBranchMergedStatus;
189
194
  private getBranchMergedStatusCore;
190
195
  getLocalBranchByUpstream(repoPath: string, remoteBranchName: string, cancellation?: AbortSignal): Promise<GitBranch | undefined>;
191
196
  /**
@@ -1059,28 +1059,32 @@ var BranchesGitSubProvider = class {
1059
1059
  }
1060
1060
  async getBranchMergedStatus(repoPath, branch, into, cancellation) {
1061
1061
  if (branch.name === into.name || branch.upstream?.name === into.name) return { merged: false };
1062
+ const merged = await this.getCachedBranchMergedStatus(repoPath, branch, into, cancellation);
1063
+ if (merged.merged) return merged;
1062
1064
  const localInto = into.remote ? await this.getLocalBranchByUpstream(repoPath, into.name, cancellation) : void 0;
1063
- const cacheKey = branch.sha != null && into.sha != null ? `${branch.remote ? "r" : "l"}:${branch.name}@${branch.sha}|${into.remote ? "r" : "l"}:${into.name}@${into.sha}${localInto?.sha != null ? `|L:${localInto.name}@${localInto.sha}` : ""}` : `${branch.remote ? "r" : "l"}:${branch.name}|${into.remote ? "r" : "l"}:${into.name}`;
1064
- return this.cache.getBranchMergedStatus(repoPath, cacheKey, async (commonPath, _cacheable, signal) => {
1065
- const result = await this.getBranchMergedStatusCore(commonPath, branch, into, signal);
1066
- if (result.merged) return result;
1067
- if (localInto != null && localInto.name !== branch.name) {
1068
- if (localInto.sha != null && localInto.sha === into.sha) return { merged: false };
1069
- const result = await this.getBranchMergedStatusCore(commonPath, branch, localInto, signal);
1070
- if (result.merged) return {
1071
- ...result,
1072
- localBranchOnly: createReference(localInto.ref, commonPath, {
1073
- id: getBranchId(commonPath, localInto.remote, localInto.name),
1074
- refType: "branch",
1075
- name: localInto.name,
1076
- remote: localInto.remote,
1077
- upstream: localInto.upstream,
1078
- sha: localInto.sha
1079
- })
1080
- };
1081
- }
1082
- return { merged: false };
1083
- }, cancellation);
1065
+ if (localInto == null || localInto.name === branch.name) return { merged: false };
1066
+ if (localInto.sha != null && localInto.sha === into.sha) return { merged: false };
1067
+ const localMerged = await this.getCachedBranchMergedStatus(repoPath, branch, localInto, cancellation);
1068
+ if (!localMerged.merged) return { merged: false };
1069
+ return {
1070
+ ...localMerged,
1071
+ localBranchOnly: createReference(localInto.ref, repoPath, {
1072
+ id: getBranchId(repoPath, localInto.remote, localInto.name),
1073
+ refType: "branch",
1074
+ name: localInto.name,
1075
+ remote: localInto.remote,
1076
+ upstream: localInto.upstream,
1077
+ sha: localInto.sha
1078
+ })
1079
+ };
1080
+ }
1081
+ /**
1082
+ * Whether `branch` is merged into `into`, cached per pair. `into` and its local counterpart are cached apart, so a
1083
+ * move of one (a fetch moving the remote target) doesn't recheck the other.
1084
+ */
1085
+ getCachedBranchMergedStatus(repoPath, branch, into, cancellation) {
1086
+ const cacheKey = branch.sha != null && into.sha != null ? `${branch.remote ? "r" : "l"}:${branch.name}@${branch.sha}|${into.remote ? "r" : "l"}:${into.name}@${into.sha}` : `${branch.remote ? "r" : "l"}:${branch.name}|${into.remote ? "r" : "l"}:${into.name}`;
1087
+ return this.cache.getBranchMergedStatus(repoPath, cacheKey, (commonPath, _cacheable, signal) => this.getBranchMergedStatusCore(commonPath, branch, into, signal), cancellation);
1084
1088
  }
1085
1089
  async getBranchMergedStatusCore(repoPath, branch, into, cancellation) {
1086
1090
  const scope = getScopedLogger();