@gitkraken/core-gitlens 0.37.0 → 0.38.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 (119) hide show
  1. package/CHANGELOG.md +67 -1
  2. package/dist/git/cache.d.ts +128 -8
  3. package/dist/git/cache.js +425 -46
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/features.d.ts +1 -1
  6. package/dist/git/features.js +3 -0
  7. package/dist/git/features.js.map +1 -1
  8. package/dist/git/providers/branches.d.ts +42 -1
  9. package/dist/git/providers/diff.d.ts +17 -0
  10. package/dist/git/providers/provider.d.ts +7 -0
  11. package/dist/git/providers/shared/remotes.js +8 -4
  12. package/dist/git/providers/shared/remotes.js.map +1 -1
  13. package/dist/git/remotes/matcher.js +2 -2
  14. package/dist/git/remotes/matcher.js.map +1 -1
  15. package/dist/git/repositoryService.d.ts +16 -1
  16. package/dist/git/repositoryService.js +51 -3
  17. package/dist/git/repositoryService.js.map +1 -1
  18. package/dist/git/run.types.d.ts +1 -0
  19. package/dist/git/service.js +6 -2
  20. package/dist/git/service.js.map +1 -1
  21. package/dist/git/utils/fileStatus.utils.d.ts +5 -0
  22. package/dist/git/utils/fileStatus.utils.js +18 -1
  23. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  24. package/dist/git/watching/changeEvent.d.ts +13 -3
  25. package/dist/git/watching/changeEvent.js +15 -4
  26. package/dist/git/watching/changeEvent.js.map +1 -1
  27. package/dist/git/watching/changeOrdinal.d.ts +9 -0
  28. package/dist/git/watching/changeOrdinal.js +14 -0
  29. package/dist/git/watching/changeOrdinal.js.map +1 -0
  30. package/dist/git/watching/unwatchedCacheValidator.d.ts +38 -5
  31. package/dist/git/watching/unwatchedCacheValidator.js +180 -36
  32. package/dist/git/watching/unwatchedCacheValidator.js.map +1 -1
  33. package/dist/git/watching/watchGroup.d.ts +63 -14
  34. package/dist/git/watching/watchGroup.js +213 -74
  35. package/dist/git/watching/watchGroup.js.map +1 -1
  36. package/dist/git/watching/watchService.js +4 -3
  37. package/dist/git/watching/watchService.js.map +1 -1
  38. package/dist/git/watching/watchSession.d.ts +10 -2
  39. package/dist/git/watching/watchSession.js +18 -4
  40. package/dist/git/watching/watchSession.js.map +1 -1
  41. package/dist/git/watching/watcherPatterns.d.ts +18 -4
  42. package/dist/git/watching/watcherPatterns.js +39 -8
  43. package/dist/git/watching/watcherPatterns.js.map +1 -1
  44. package/dist/git/watching/worktreeSummary.d.ts +23 -12
  45. package/dist/git/watching/worktreeSummary.js +164 -41
  46. package/dist/git/watching/worktreeSummary.js.map +1 -1
  47. package/dist/git-cli/cliGitProvider.d.ts +1 -0
  48. package/dist/git-cli/cliGitProvider.js +11 -2
  49. package/dist/git-cli/cliGitProvider.js.map +1 -1
  50. package/dist/git-cli/exec/git.d.ts +7 -2
  51. package/dist/git-cli/exec/git.js +46 -10
  52. package/dist/git-cli/exec/git.js.map +1 -1
  53. package/dist/git-cli/exec/headState.d.ts +24 -0
  54. package/dist/git-cli/exec/headState.js +46 -6
  55. package/dist/git-cli/exec/headState.js.map +1 -1
  56. package/dist/git-cli/parsers/logParser.js +6 -3
  57. package/dist/git-cli/parsers/logParser.js.map +1 -1
  58. package/dist/git-cli/providers/branches.d.ts +135 -10
  59. package/dist/git-cli/providers/branches.js +622 -80
  60. package/dist/git-cli/providers/branches.js.map +1 -1
  61. package/dist/git-cli/providers/commits.d.ts +16 -0
  62. package/dist/git-cli/providers/commits.js +80 -28
  63. package/dist/git-cli/providers/commits.js.map +1 -1
  64. package/dist/git-cli/providers/config.d.ts +10 -0
  65. package/dist/git-cli/providers/config.js +50 -12
  66. package/dist/git-cli/providers/config.js.map +1 -1
  67. package/dist/git-cli/providers/contributors.js +11 -7
  68. package/dist/git-cli/providers/contributors.js.map +1 -1
  69. package/dist/git-cli/providers/diff.d.ts +12 -0
  70. package/dist/git-cli/providers/diff.js +107 -15
  71. package/dist/git-cli/providers/diff.js.map +1 -1
  72. package/dist/git-cli/providers/graph.js +32 -25
  73. package/dist/git-cli/providers/graph.js.map +1 -1
  74. package/dist/git-cli/providers/operations.d.ts +37 -3
  75. package/dist/git-cli/providers/operations.js +124 -46
  76. package/dist/git-cli/providers/operations.js.map +1 -1
  77. package/dist/git-cli/providers/patch.js +1 -1
  78. package/dist/git-cli/providers/patch.js.map +1 -1
  79. package/dist/git-cli/providers/refs.d.ts +1 -1
  80. package/dist/git-cli/providers/refs.js +10 -11
  81. package/dist/git-cli/providers/refs.js.map +1 -1
  82. package/dist/git-cli/providers/status.d.ts +4 -5
  83. package/dist/git-cli/providers/status.js +36 -33
  84. package/dist/git-cli/providers/status.js.map +1 -1
  85. package/dist/git-cli/providers/tags.d.ts +8 -0
  86. package/dist/git-cli/providers/tags.js +53 -34
  87. package/dist/git-cli/providers/tags.js.map +1 -1
  88. package/dist/git-cli/service.d.ts +15 -0
  89. package/dist/git-cli/service.js +19 -1
  90. package/dist/git-cli/service.js.map +1 -1
  91. package/dist/plus/git-github/api/github.d.ts +4 -0
  92. package/dist/plus/git-github/api/github.js +11 -1
  93. package/dist/plus/git-github/api/github.js.map +1 -1
  94. package/dist/plus/git-github/providers/github/diff.d.ts +1 -0
  95. package/dist/plus/git-github/providers/github/diff.js +6 -1
  96. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  97. package/dist/plus/integrations/integrationService.js +9 -0
  98. package/dist/plus/integrations/integrationService.js.map +1 -1
  99. package/dist/plus/integrations/providers/jira-server.js +1 -1
  100. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  101. package/dist/plus/integrations/providers/jira.d.ts +38 -6
  102. package/dist/plus/integrations/providers/jira.js +111 -69
  103. package/dist/plus/integrations/providers/jira.js.map +1 -1
  104. package/dist/plus/integrations/providers/linear.d.ts +31 -3
  105. package/dist/plus/integrations/providers/linear.js +77 -18
  106. package/dist/plus/integrations/providers/linear.js.map +1 -1
  107. package/dist/plus/integrations/providers/utils/discoveryCache.d.ts +41 -4
  108. package/dist/plus/integrations/providers/utils/discoveryCache.js +50 -11
  109. package/dist/plus/integrations/providers/utils/discoveryCache.js.map +1 -1
  110. package/dist/utils/env/node/exec.d.ts +5 -4
  111. package/dist/utils/env/node/exec.js +52 -9
  112. package/dist/utils/env/node/exec.js.map +1 -1
  113. package/dist/utils/holdOffMap.d.ts +23 -0
  114. package/dist/utils/holdOffMap.js +43 -0
  115. package/dist/utils/holdOffMap.js.map +1 -0
  116. package/dist/utils/promiseCache.d.ts +15 -2
  117. package/dist/utils/promiseCache.js +34 -4
  118. package/dist/utils/promiseCache.js.map +1 -1
  119. package/package.json +1 -1
@@ -22,6 +22,30 @@ export type HeadState = {
22
22
  * a symlinked HEAD would say a write on its branch moved no branch. Never rejects.
23
23
  */
24
24
  export declare function readHeadState(repoPath: string, fs: FileSystemProvider, cache: Cache): Promise<HeadState>;
25
+ /**
26
+ * A stamp of `repoPath`'s `HEAD` file — its modification and change times and size — read without running git, or
27
+ * `undefined` when it can't be read. Git rewrites `HEAD` by writing `HEAD.lock` and renaming it over `HEAD` (a checkout
28
+ * or a rebase), which changes the stamp; a commit, merge or fast-forward moves the branch `HEAD` names and leaves the
29
+ * file be, so a stamp that differs between two reads says a write rewrote the file. Never rejects.
30
+ */
31
+ export declare function readHeadStamp(repoPath: string, fs: FileSystemProvider, cache: Cache): Promise<string | undefined>;
32
+ /** What `repoPath`'s HEAD is on and the stamp of its file, read together (see {@link readHeadState}, {@link readHeadStamp}) */
33
+ export interface HeadSnapshot {
34
+ readonly state: HeadState;
35
+ readonly stamp: string | undefined;
36
+ }
37
+ /** Reads `repoPath`'s HEAD and its file's stamp concurrently. Never rejects. */
38
+ export declare function readHeadSnapshot(repoPath: string, fs: FileSystemProvider, cache: Cache): Promise<HeadSnapshot>;
39
+ /**
40
+ * How a write changed HEAD, from {@link HeadSnapshot}s read before and after it: `detached` when HEAD was on a branch
41
+ * and is on none now (a rebase stopped partway), `rewrote` when it stayed on a branch and the file was rewritten (a
42
+ * rebase that finished replays its commits with HEAD detached, then points it back). Each is `false` when a read
43
+ * failed, so a write is announced no more than one that left HEAD be would be.
44
+ */
45
+ export declare function getHeadWrite(before: HeadSnapshot, after: HeadSnapshot): {
46
+ readonly detached: boolean;
47
+ readonly rewrote: boolean;
48
+ };
25
49
  /**
26
50
  * The path of `repoPath`'s common git dir, without running git: the cached one, else the folder `<repoPath>/.git` is,
27
51
  * or the shared one a linked worktree's `gitdir:` file leads to. `undefined` when it can't be read. Never rejects.
@@ -17,11 +17,7 @@ const headShaRegex = /^(?:[0-9a-f]{40}|[0-9a-f]{64})\s*$/;
17
17
  */
18
18
  async function readHeadState(repoPath, fs, cache) {
19
19
  try {
20
- const cached = cache.gitDir.get(repoPath);
21
- const gitDir = cached != null ? {
22
- uri: cached.uri,
23
- commonUri: cached.commonUri
24
- } : await findGitDir(repoPath, fs);
20
+ const gitDir = await resolveGitDir(repoPath, fs, cache);
25
21
  if (gitDir == null) return void 0;
26
22
  const decoder = new TextDecoder();
27
23
  const head = decoder.decode(await fs.readFile(joinUriPath(gitDir.uri, "HEAD")));
@@ -38,6 +34,43 @@ async function readHeadState(repoPath, fs, cache) {
38
34
  }
39
35
  }
40
36
  /**
37
+ * A stamp of `repoPath`'s `HEAD` file — its modification and change times and size — read without running git, or
38
+ * `undefined` when it can't be read. Git rewrites `HEAD` by writing `HEAD.lock` and renaming it over `HEAD` (a checkout
39
+ * or a rebase), which changes the stamp; a commit, merge or fast-forward moves the branch `HEAD` names and leaves the
40
+ * file be, so a stamp that differs between two reads says a write rewrote the file. Never rejects.
41
+ */
42
+ async function readHeadStamp(repoPath, fs, cache) {
43
+ try {
44
+ const gitDir = await resolveGitDir(repoPath, fs, cache);
45
+ if (gitDir == null) return void 0;
46
+ const stat = await fs.stat(joinUriPath(gitDir.uri, "HEAD"));
47
+ return stat != null ? `${stat.mtime}:${stat.ctime}:${stat.size}` : void 0;
48
+ } catch {
49
+ return;
50
+ }
51
+ }
52
+ /** Reads `repoPath`'s HEAD and its file's stamp concurrently. Never rejects. */
53
+ async function readHeadSnapshot(repoPath, fs, cache) {
54
+ const [state, stamp] = await Promise.all([readHeadState(repoPath, fs, cache), readHeadStamp(repoPath, fs, cache)]);
55
+ return {
56
+ state,
57
+ stamp
58
+ };
59
+ }
60
+ /**
61
+ * How a write changed HEAD, from {@link HeadSnapshot}s read before and after it: `detached` when HEAD was on a branch
62
+ * and is on none now (a rebase stopped partway), `rewrote` when it stayed on a branch and the file was rewritten (a
63
+ * rebase that finished replays its commits with HEAD detached, then points it back). Each is `false` when a read
64
+ * failed, so a write is announced no more than one that left HEAD be would be.
65
+ */
66
+ function getHeadWrite(before, after) {
67
+ const detached = before.state != null && before.state !== "detached" && after.state === "detached";
68
+ return {
69
+ detached,
70
+ rewrote: !detached && before.stamp != null && after.stamp != null && before.stamp !== after.stamp
71
+ };
72
+ }
73
+ /**
41
74
  * The path of `repoPath`'s common git dir, without running git: the cached one, else the folder `<repoPath>/.git` is,
42
75
  * or the shared one a linked worktree's `gitdir:` file leads to. `undefined` when it can't be read. Never rejects.
43
76
  */
@@ -50,6 +83,13 @@ async function readCommonGitDir(repoPath, fs, cache) {
50
83
  return;
51
84
  }
52
85
  }
86
+ async function resolveGitDir(repoPath, fs, cache) {
87
+ const cached = cache.gitDir.get(repoPath);
88
+ return cached != null ? {
89
+ uri: cached.uri,
90
+ commonUri: cached.commonUri
91
+ } : findGitDir(repoPath, fs);
92
+ }
53
93
  /**
54
94
  * The git dir `<repoPath>/.git` is: the folder itself, or the one a linked worktree's `gitdir:` file names, whose
55
95
  * `commondir` file names the repository's shared one
@@ -86,6 +126,6 @@ function getMovedHead(before, after) {
86
126
  return before.branch === after.branch ? before : void 0;
87
127
  }
88
128
  //#endregion
89
- export { getMovedHead, readCommonGitDir, readHeadState };
129
+ export { getHeadWrite, getMovedHead, readCommonGitDir, readHeadSnapshot, readHeadStamp, readHeadState };
90
130
 
91
131
  //# sourceMappingURL=headState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"headState.js","names":["resolvePath"],"sources":["../../../../git-cli/src/exec/headState.ts"],"sourcesContent":["import { resolve as resolvePath } from 'node:path';\nimport type { Cache } from '@gitlens/git/cache.js';\nimport type { FileSystemProvider } from '@gitlens/git/context.js';\nimport { FileType } from '@gitlens/git/context.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { fileUri, joinUriPath } from '@gitlens/utils/uri.js';\nimport { parseCommonDir, parseGitFile } from './gitDirResolver.js';\n\n/**\n * What a worktree's HEAD is on: the full name of its branch (`refs/heads/main`), `'detached'`, or `undefined` when\n * unknown — unreadable, not a branch name git allows, or a HEAD kept as a symlink to its branch\n * (`core.preferSymlinkRefs`). Reading such a HEAD follows the link to the branch's object id, as a detached HEAD\n * reads, so it is unknown when the git dir's listing flags it as a link, and `'detached'` on a host whose listing\n * doesn't.\n */\nexport type HeadState = { readonly branch: string } | 'detached' | undefined;\n\nconst headBranchRegex = /^ref:\\s*(refs\\/heads\\/\\S+)\\s*$/;\nconst headShaRegex = /^(?:[0-9a-f]{40}|[0-9a-f]{64})\\s*$/;\n\n/**\n * Reads `repoPath`'s HEAD from the worktree's own `HEAD` file, without running git: read around a write, it says which\n * branch that write moved, whatever a switch outside core left in the caches. The git dir is the cached one, else the\n * one `<repoPath>/.git` is or points to, so a worktree core never registered is read without spawning git either.\n * A reftable repository's `HEAD` file holds the placeholder `refs/heads/.invalid` (its real HEAD is in the tables),\n * which is no branch name git allows, so it reads as unknown, as does a branch that is a symbolic ref to another (a\n * `master` kept pointing at `main`), since git follows it and a write moves the target. An object id is detached only\n * when the git dir's listing doesn't flag `HEAD` as a symlink (a host's `stat` may follow the link): read as detached,\n * a symlinked HEAD would say a write on its branch moved no branch. Never rejects.\n */\nexport async function readHeadState(repoPath: string, fs: FileSystemProvider, cache: Cache): Promise<HeadState> {\n\ttry {\n\t\tconst cached = cache.gitDir.get(repoPath);\n\t\tconst gitDir =\n\t\t\tcached != null ? { uri: cached.uri, commonUri: cached.commonUri } : await findGitDir(repoPath, fs);\n\t\tif (gitDir == null) return undefined;\n\n\t\tconst decoder = new TextDecoder();\n\t\tconst head = decoder.decode(await fs.readFile(joinUriPath(gitDir.uri, 'HEAD')));\n\t\tif (headShaRegex.test(head)) {\n\t\t\tconst entries = await fs.readDirectory(gitDir.uri);\n\t\t\tconst linked = entries.some(([name, type]) => name === 'HEAD' && (type & FileType.SymbolicLink) !== 0);\n\t\t\treturn linked ? undefined : 'detached';\n\t\t}\n\n\t\tconst ref = headBranchRegex.exec(head)?.[1];\n\t\tif (ref == null || ref.split('/').some(part => part.startsWith('.'))) return undefined;\n\n\t\t// Packed refs can't hold a symbolic ref, so a missing loose file is a plain branch\n\t\tlet target: string | undefined;\n\t\ttry {\n\t\t\ttarget = decoder.decode(await fs.readFile(joinUriPath(gitDir.commonUri ?? gitDir.uri, ref)));\n\t\t} catch {}\n\t\treturn target?.startsWith('ref:') ? undefined : { branch: ref };\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * The path of `repoPath`'s common git dir, without running git: the cached one, else the folder `<repoPath>/.git` is,\n * or the shared one a linked worktree's `gitdir:` file leads to. `undefined` when it can't be read. Never rejects.\n */\nexport async function readCommonGitDir(\n\trepoPath: string,\n\tfs: FileSystemProvider,\n\tcache: Cache,\n): Promise<string | undefined> {\n\ttry {\n\t\tconst gitDir = cache.gitDir.get(repoPath) ?? (await findGitDir(repoPath, fs));\n\t\tif (gitDir == null) return undefined;\n\n\t\treturn (gitDir.commonUri ?? gitDir.uri).fsPath;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * The git dir `<repoPath>/.git` is: the folder itself, or the one a linked worktree's `gitdir:` file names, whose\n * `commondir` file names the repository's shared one\n */\nasync function findGitDir(\n\trepoPath: string,\n\tfs: FileSystemProvider,\n): Promise<{ readonly uri: Uri; readonly commonUri: Uri | undefined } | undefined> {\n\tconst dotGit = joinUriPath(fileUri(repoPath), '.git');\n\tconst stat = await fs.stat(dotGit);\n\tif (stat == null) return undefined;\n\tif (stat.type & FileType.Directory) return { uri: dotGit, commonUri: undefined };\n\n\tconst dir = parseGitFile(new TextDecoder().decode(await fs.readFile(dotGit)));\n\tif (dir == null) return undefined;\n\n\tconst gitDir = resolvePath(repoPath, dir);\n\tlet commonDir: string | undefined;\n\ttry {\n\t\tcommonDir = parseCommonDir(\n\t\t\tnew TextDecoder().decode(await fs.readFile(joinUriPath(fileUri(gitDir), 'commondir'))),\n\t\t);\n\t} catch {}\n\treturn { uri: fileUri(gitDir), commonUri: commonDir ? fileUri(resolvePath(gitDir, commonDir)) : undefined };\n}\n\n/**\n * Which branch a write that moves only HEAD's branch moved, from HEAD read before and after it: that branch when HEAD\n * was on the same one both times, `'detached'` (no branch) when it was detached both times, otherwise `undefined` — a\n * hook or an outside switch moved HEAD meanwhile, or a read failed, so the moved branch is unknown.\n */\nexport function getMovedHead(before: HeadState, after: HeadState): HeadState {\n\tif (before == null || after == null) return undefined;\n\tif (before === 'detached') return after === 'detached' ? 'detached' : undefined;\n\tif (after === 'detached') return undefined;\n\n\treturn before.branch === after.branch ? before : undefined;\n}\n"],"mappings":";;;;;AAiBA,MAAM,kBAAkB;AACxB,MAAM,eAAe;;;;;;;;;;;AAYrB,eAAsB,cAAc,UAAkB,IAAwB,OAAkC;CAC/G,IAAI;EACH,MAAM,SAAS,MAAM,OAAO,IAAI,QAAQ;EACxC,MAAM,SACL,UAAU,OAAO;GAAE,KAAK,OAAO;GAAK,WAAW,OAAO;EAAU,IAAI,MAAM,WAAW,UAAU,EAAE;EAClG,IAAI,UAAU,MAAM,OAAO,KAAA;EAE3B,MAAM,UAAU,IAAI,YAAY;EAChC,MAAM,OAAO,QAAQ,OAAO,MAAM,GAAG,SAAS,YAAY,OAAO,KAAK,MAAM,CAAC,CAAC;EAC9E,IAAI,aAAa,KAAK,IAAI,GAGzB,QADe,MADO,GAAG,cAAc,OAAO,GAAG,EAAA,CAC1B,MAAM,CAAC,MAAM,UAAU,SAAS,WAAW,OAAO,SAAS,kBAAkB,CACxF,IAAI,KAAA,IAAY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AAG,WAAW,YAAY,QAAQA,QAAY,QAAQ,SAAS,CAAC,IAAI,KAAA;CAAU;AAC3G;;;;;;AAOA,SAAgB,aAAa,QAAmB,OAA6B;CAC5E,IAAI,UAAU,QAAQ,SAAS,MAAM,OAAO,KAAA;CAC5C,IAAI,WAAW,YAAY,OAAO,UAAU,aAAa,aAAa,KAAA;CACtE,IAAI,UAAU,YAAY,OAAO,KAAA;CAEjC,OAAO,OAAO,WAAW,MAAM,SAAS,SAAS,KAAA;AAClD"}
1
+ {"version":3,"file":"headState.js","names":["resolvePath"],"sources":["../../../../git-cli/src/exec/headState.ts"],"sourcesContent":["import { resolve as resolvePath } from 'node:path';\nimport type { Cache } from '@gitlens/git/cache.js';\nimport type { FileSystemProvider } from '@gitlens/git/context.js';\nimport { FileType } from '@gitlens/git/context.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { fileUri, joinUriPath } from '@gitlens/utils/uri.js';\nimport { parseCommonDir, parseGitFile } from './gitDirResolver.js';\n\n/**\n * What a worktree's HEAD is on: the full name of its branch (`refs/heads/main`), `'detached'`, or `undefined` when\n * unknown — unreadable, not a branch name git allows, or a HEAD kept as a symlink to its branch\n * (`core.preferSymlinkRefs`). Reading such a HEAD follows the link to the branch's object id, as a detached HEAD\n * reads, so it is unknown when the git dir's listing flags it as a link, and `'detached'` on a host whose listing\n * doesn't.\n */\nexport type HeadState = { readonly branch: string } | 'detached' | undefined;\n\nconst headBranchRegex = /^ref:\\s*(refs\\/heads\\/\\S+)\\s*$/;\nconst headShaRegex = /^(?:[0-9a-f]{40}|[0-9a-f]{64})\\s*$/;\n\n/**\n * Reads `repoPath`'s HEAD from the worktree's own `HEAD` file, without running git: read around a write, it says which\n * branch that write moved, whatever a switch outside core left in the caches. The git dir is the cached one, else the\n * one `<repoPath>/.git` is or points to, so a worktree core never registered is read without spawning git either.\n * A reftable repository's `HEAD` file holds the placeholder `refs/heads/.invalid` (its real HEAD is in the tables),\n * which is no branch name git allows, so it reads as unknown, as does a branch that is a symbolic ref to another (a\n * `master` kept pointing at `main`), since git follows it and a write moves the target. An object id is detached only\n * when the git dir's listing doesn't flag `HEAD` as a symlink (a host's `stat` may follow the link): read as detached,\n * a symlinked HEAD would say a write on its branch moved no branch. Never rejects.\n */\nexport async function readHeadState(repoPath: string, fs: FileSystemProvider, cache: Cache): Promise<HeadState> {\n\ttry {\n\t\tconst gitDir = await resolveGitDir(repoPath, fs, cache);\n\t\tif (gitDir == null) return undefined;\n\n\t\tconst decoder = new TextDecoder();\n\t\tconst head = decoder.decode(await fs.readFile(joinUriPath(gitDir.uri, 'HEAD')));\n\t\tif (headShaRegex.test(head)) {\n\t\t\tconst entries = await fs.readDirectory(gitDir.uri);\n\t\t\tconst linked = entries.some(([name, type]) => name === 'HEAD' && (type & FileType.SymbolicLink) !== 0);\n\t\t\treturn linked ? undefined : 'detached';\n\t\t}\n\n\t\tconst ref = headBranchRegex.exec(head)?.[1];\n\t\tif (ref == null || ref.split('/').some(part => part.startsWith('.'))) return undefined;\n\n\t\t// Packed refs can't hold a symbolic ref, so a missing loose file is a plain branch\n\t\tlet target: string | undefined;\n\t\ttry {\n\t\t\ttarget = decoder.decode(await fs.readFile(joinUriPath(gitDir.commonUri ?? gitDir.uri, ref)));\n\t\t} catch {}\n\t\treturn target?.startsWith('ref:') ? undefined : { branch: ref };\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * A stamp of `repoPath`'s `HEAD` file — its modification and change times and size — read without running git, or\n * `undefined` when it can't be read. Git rewrites `HEAD` by writing `HEAD.lock` and renaming it over `HEAD` (a checkout\n * or a rebase), which changes the stamp; a commit, merge or fast-forward moves the branch `HEAD` names and leaves the\n * file be, so a stamp that differs between two reads says a write rewrote the file. Never rejects.\n */\nexport async function readHeadStamp(\n\trepoPath: string,\n\tfs: FileSystemProvider,\n\tcache: Cache,\n): Promise<string | undefined> {\n\ttry {\n\t\tconst gitDir = await resolveGitDir(repoPath, fs, cache);\n\t\tif (gitDir == null) return undefined;\n\n\t\tconst stat = await fs.stat(joinUriPath(gitDir.uri, 'HEAD'));\n\t\treturn stat != null ? `${stat.mtime}:${stat.ctime}:${stat.size}` : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/** What `repoPath`'s HEAD is on and the stamp of its file, read together (see {@link readHeadState}, {@link readHeadStamp}) */\nexport interface HeadSnapshot {\n\treadonly state: HeadState;\n\treadonly stamp: string | undefined;\n}\n\n/** Reads `repoPath`'s HEAD and its file's stamp concurrently. Never rejects. */\nexport async function readHeadSnapshot(repoPath: string, fs: FileSystemProvider, cache: Cache): Promise<HeadSnapshot> {\n\tconst [state, stamp] = await Promise.all([readHeadState(repoPath, fs, cache), readHeadStamp(repoPath, fs, cache)]);\n\treturn { state: state, stamp: stamp };\n}\n\n/**\n * How a write changed HEAD, from {@link HeadSnapshot}s read before and after it: `detached` when HEAD was on a branch\n * and is on none now (a rebase stopped partway), `rewrote` when it stayed on a branch and the file was rewritten (a\n * rebase that finished replays its commits with HEAD detached, then points it back). Each is `false` when a read\n * failed, so a write is announced no more than one that left HEAD be would be.\n */\nexport function getHeadWrite(\n\tbefore: HeadSnapshot,\n\tafter: HeadSnapshot,\n): { readonly detached: boolean; readonly rewrote: boolean } {\n\tconst detached = before.state != null && before.state !== 'detached' && after.state === 'detached';\n\tconst rewrote = !detached && before.stamp != null && after.stamp != null && before.stamp !== after.stamp;\n\treturn { detached: detached, rewrote: rewrote };\n}\n\n/**\n * The path of `repoPath`'s common git dir, without running git: the cached one, else the folder `<repoPath>/.git` is,\n * or the shared one a linked worktree's `gitdir:` file leads to. `undefined` when it can't be read. Never rejects.\n */\nexport async function readCommonGitDir(\n\trepoPath: string,\n\tfs: FileSystemProvider,\n\tcache: Cache,\n): Promise<string | undefined> {\n\ttry {\n\t\tconst gitDir = cache.gitDir.get(repoPath) ?? (await findGitDir(repoPath, fs));\n\t\tif (gitDir == null) return undefined;\n\n\t\treturn (gitDir.commonUri ?? gitDir.uri).fsPath;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nasync function resolveGitDir(\n\trepoPath: string,\n\tfs: FileSystemProvider,\n\tcache: Cache,\n): Promise<{ readonly uri: Uri; readonly commonUri: Uri | undefined } | undefined> {\n\tconst cached = cache.gitDir.get(repoPath);\n\treturn cached != null ? { uri: cached.uri, commonUri: cached.commonUri } : findGitDir(repoPath, fs);\n}\n\n/**\n * The git dir `<repoPath>/.git` is: the folder itself, or the one a linked worktree's `gitdir:` file names, whose\n * `commondir` file names the repository's shared one\n */\nasync function findGitDir(\n\trepoPath: string,\n\tfs: FileSystemProvider,\n): Promise<{ readonly uri: Uri; readonly commonUri: Uri | undefined } | undefined> {\n\tconst dotGit = joinUriPath(fileUri(repoPath), '.git');\n\tconst stat = await fs.stat(dotGit);\n\tif (stat == null) return undefined;\n\tif (stat.type & FileType.Directory) return { uri: dotGit, commonUri: undefined };\n\n\tconst dir = parseGitFile(new TextDecoder().decode(await fs.readFile(dotGit)));\n\tif (dir == null) return undefined;\n\n\tconst gitDir = resolvePath(repoPath, dir);\n\tlet commonDir: string | undefined;\n\ttry {\n\t\tcommonDir = parseCommonDir(\n\t\t\tnew TextDecoder().decode(await fs.readFile(joinUriPath(fileUri(gitDir), 'commondir'))),\n\t\t);\n\t} catch {}\n\treturn { uri: fileUri(gitDir), commonUri: commonDir ? fileUri(resolvePath(gitDir, commonDir)) : undefined };\n}\n\n/**\n * Which branch a write that moves only HEAD's branch moved, from HEAD read before and after it: that branch when HEAD\n * was on the same one both times, `'detached'` (no branch) when it was detached both times, otherwise `undefined` — a\n * hook or an outside switch moved HEAD meanwhile, or a read failed, so the moved branch is unknown.\n */\nexport function getMovedHead(before: HeadState, after: HeadState): HeadState {\n\tif (before == null || after == null) return undefined;\n\tif (before === 'detached') return after === 'detached' ? 'detached' : undefined;\n\tif (after === 'detached') return undefined;\n\n\treturn before.branch === after.branch ? before : undefined;\n}\n"],"mappings":";;;;;AAiBA,MAAM,kBAAkB;AACxB,MAAM,eAAe;;;;;;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YAAY,QAAQ,MAAM,GAAG,WAAW,CAAC,CAAC,CACtF;CACD,QAAQ,CAAC;CACT,OAAO;EAAE,KAAK,QAAQ,MAAM;EAAG,WAAW,YAAY,QAAQA,QAAY,QAAQ,SAAS,CAAC,IAAI,KAAA;CAAU;AAC3G;;;;;;AAOA,SAAgB,aAAa,QAAmB,OAA6B;CAC5E,IAAI,UAAU,QAAQ,SAAS,MAAM,OAAO,KAAA;CAC5C,IAAI,WAAW,YAAY,OAAO,UAAU,aAAa,aAAa,KAAA;CACtE,IAAI,UAAU,YAAY,OAAO,KAAA;CAEjC,OAAO,OAAO,WAAW,MAAM,SAAS,SAAS,KAAA;AAClD"}
@@ -163,6 +163,9 @@ const recordSep = "";
163
163
  const recordFormatSep = "%x1E";
164
164
  const fieldSep = "";
165
165
  const fieldFormatSep = "%x1D";
166
+ function appendAll(target, items) {
167
+ for (const item of items) target.push(item);
168
+ }
166
169
  function isCompleteRecord(record, requiredFields) {
167
170
  let count = 0;
168
171
  let index = -1;
@@ -433,7 +436,7 @@ function createLogParserWithFilesAndStats(mapping) {
433
436
  if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
434
437
  else if (fieldCount === keys.length) {
435
438
  const summary = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
436
- files.push(...parseFilesAndStats(summary));
439
+ appendAll(files, parseFilesAndStats(summary));
437
440
  } else debugger;
438
441
  }
439
442
  entry.files = files;
@@ -491,7 +494,7 @@ function createLogParserWithFilesAndStats(mapping) {
491
494
  if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
492
495
  else if (fieldCount === keys.length) {
493
496
  const summary = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
494
- files.push(...parseFilesAndStats(summary));
497
+ appendAll(files, parseFilesAndStats(summary));
495
498
  } else debugger;
496
499
  }
497
500
  entry.files = files;
@@ -612,7 +615,7 @@ function createLogParserWithFileSummary(mapping) {
612
615
  if (fieldCount < keys.length) entry[keys[fieldCount++]] = field.value;
613
616
  else if (fieldCount === keys.length) {
614
617
  const summary = field.value.startsWith("\n\n") ? field.value.substring(2) : field.value.startsWith("\n") ? field.value.substring(1) : field.value;
615
- files.push(...parseFileSummary(summary));
618
+ appendAll(files, parseFileSummary(summary));
616
619
  } else debugger;
617
620
  }
618
621
  entry.files = files;
@@ -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, diffRegex } 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 } 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// 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\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 = pathPart.substring(0, pathTabIndex);\n\t\t\t\t\tpath = pathPart.substring(pathTabIndex + 1);\n\t\t\t\t} else {\n\t\t\t\t\tpath = pathPart;\n\t\t\t\t}\n\n\t\t\t\t// Trim to match parseCopyOrRename which trims renamed paths\n\t\t\t\tinfoMap.set(path.trim(), {\n\t\t\t\t\tmode: newMode,\n\t\t\t\t\tstatus: status,\n\t\t\t\t\toriginalPath: originalPath?.trim(),\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\")\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 trimmed new/destination path)\n\t\t\t\tconst info = infoMap.get(path.trim());\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.trim(),\n\t\t\t\t\toriginalPath: originalPath?.trim(),\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\tfiles.push(...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\tfiles.push(...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 = 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\tfiles.push(...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\nfunction parseCopyOrRename(path: string, stripPercentage: boolean): { path: string; originalPath?: string } {\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\tconst fileMatch = diffRegex.exec(line.value);\n\t\tif (fileMatch == 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: (fileMatch[1] === 'rename' ? 'R' : 'M') satisfies GitFileIndexStatus,\n\t\t\tpath: fileMatch[2],\n\t\t\toriginalPath: fileMatch[1] === 'rename' ? fileMatch[3] : 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: 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;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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I,aAAa;IACjB,IAAI;IACJ,OAAO,MAAM;KACZ,QAAQ,OAAO,KAAK;KACpB,IAAI,MAAM,MAAM;KAEhB,IAAI,aAAa,KAAK,QACrB,MAAM,KAAK,iBAAiB,MAAM;UAC5B,IAAI,eAAe,KAAK,QAAQ;MAEtC,MAAM,QAAQ,MAAM,MAAM,WAAW,MAAM,IACxC,MAAM,MAAM,UAAU,CAAC,IACvB,MAAM,MAAM,WAAW,IAAI,IAC1B,MAAM,MAAM,UAAU,CAAC,IACvB,MAAM;MACV,MAAM,QAAQ,eAAe,KAAK;KACnC,OACC;IAEF;IAEA,MAAM;GACP;GAEA,IAAI,KAAK,EAAE,QAAQ,WAAW,MAAM,UAAU,CAAC;;;;;;CAChD;CAEA,OAAO;EACN,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, diffRegex } 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 } 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\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 = pathPart.substring(0, pathTabIndex);\n\t\t\t\t\tpath = pathPart.substring(pathTabIndex + 1);\n\t\t\t\t} else {\n\t\t\t\t\tpath = pathPart;\n\t\t\t\t}\n\n\t\t\t\t// Trim to match parseCopyOrRename which trims renamed paths\n\t\t\t\tinfoMap.set(path.trim(), {\n\t\t\t\t\tmode: newMode,\n\t\t\t\t\tstatus: status,\n\t\t\t\t\toriginalPath: originalPath?.trim(),\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\")\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 trimmed new/destination path)\n\t\t\t\tconst info = infoMap.get(path.trim());\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.trim(),\n\t\t\t\t\toriginalPath: originalPath?.trim(),\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 = 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\nfunction parseCopyOrRename(path: string, stripPercentage: boolean): { path: string; originalPath?: string } {\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\tconst fileMatch = diffRegex.exec(line.value);\n\t\tif (fileMatch == 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: (fileMatch[1] === 'rename' ? 'R' : 'M') satisfies GitFileIndexStatus,\n\t\t\tpath: fileMatch[2],\n\t\t\toriginalPath: fileMatch[1] === 'rename' ? fileMatch[3] : 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: 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;CACR,aAAa;CACb,YAAY;CACZ,WAAW;CACX,gBAAgB;CAChB,eAAe;CACf,SAAS;CACT,MAAM;CACN,SAAS;AACV;AAGA,IAAI;AAEJ,IAAI;AAEJ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