@gitkraken/core-gitlens 0.38.2 → 0.38.4
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.
- package/CHANGELOG.md +24 -1
- package/dist/git/parsers/diffParser.d.ts +25 -0
- package/dist/git/parsers/diffParser.js +169 -23
- package/dist/git/parsers/diffParser.js.map +1 -1
- package/dist/git/providers/diff.d.ts +10 -0
- package/dist/git/providers/revision.d.ts +8 -1
- package/dist/git-cli/parsers/blameParser.js +25 -5
- package/dist/git-cli/parsers/blameParser.js.map +1 -1
- package/dist/git-cli/parsers/logParser.js +28 -18
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/statusParser.d.ts +5 -1
- package/dist/git-cli/parsers/statusParser.js +17 -6
- package/dist/git-cli/parsers/statusParser.js.map +1 -1
- package/dist/git-cli/parsers/treeParser.js +5 -3
- package/dist/git-cli/parsers/treeParser.js.map +1 -1
- package/dist/git-cli/parsers/worktreeParser.js +1 -41
- package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
- package/dist/git-cli/providers/diff.d.ts +2 -0
- package/dist/git-cli/providers/diff.js +10 -7
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +3 -1
- package/dist/git-cli/providers/revision.js +10 -5
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/status.js +1 -0
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts +3 -1
- package/dist/plus/git-github/providers/github/revision.js +1 -1
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +2 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +23 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +1 -0
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.js +4 -1
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/integrationService.js +7 -1
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +1 -0
- package/dist/plus/integrations/models/integration.js +8 -0
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.d.ts +5 -0
- package/dist/plus/integrations/models/issuesIntegration.js +33 -1
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +3 -2
- package/dist/plus/integrations/providers/jira.js +36 -17
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/linear.d.ts +1 -0
- package/dist/plus/integrations/providers/linear.js +40 -17
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/utils/discoveryCache.d.ts +6 -3
- package/dist/plus/integrations/providers/utils/discoveryCache.js +12 -6
- package/dist/plus/integrations/providers/utils/discoveryCache.js.map +1 -1
- package/dist/utils/string.d.ts +15 -0
- package/dist/utils/string.js +61 -1
- package/dist/utils/string.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { iterateAsyncByDelimiter, iterateByDelimiter } from "../../utils/string.js";
|
|
1
|
+
import { iterateAsyncByDelimiter, iterateByDelimiter, unquoteCString } from "../../utils/string.js";
|
|
2
2
|
import { fileUri, joinUriPath } from "../../utils/uri.js";
|
|
3
3
|
import { normalizePath } from "../../utils/path.js";
|
|
4
4
|
import { uncommitted } from "../../git/models/revision.js";
|
|
@@ -9,6 +9,22 @@ import { GitFileChange } from "../../git/models/fileChange.js";
|
|
|
9
9
|
import { GitCommit, GitCommitIdentity } from "../../git/models/commit.js";
|
|
10
10
|
import { isUserMatch } from "../../git/utils/user.utils.js";
|
|
11
11
|
//#region ../git-cli/src/parsers/blameParser.ts
|
|
12
|
+
/**
|
|
13
|
+
* Decodes one kind of blame file name, remembering the last: git repeats the file name (and the one it was renamed from)
|
|
14
|
+
* in every chunk, so a name it quoted would otherwise be decoded again each time
|
|
15
|
+
*/
|
|
16
|
+
function createPathUnquoter() {
|
|
17
|
+
let lastRaw;
|
|
18
|
+
let lastPath = "";
|
|
19
|
+
return (raw) => {
|
|
20
|
+
if (raw.charCodeAt(0) !== 34) return raw;
|
|
21
|
+
if (raw !== lastRaw) {
|
|
22
|
+
lastRaw = raw;
|
|
23
|
+
lastPath = unquoteCString(raw);
|
|
24
|
+
}
|
|
25
|
+
return lastPath;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
12
28
|
function parseGitBlame(repoPath, data, currentUser, modifiedTime) {
|
|
13
29
|
try {
|
|
14
30
|
var _usingCtx$1 = _usingCtx();
|
|
@@ -26,6 +42,8 @@ function parseGitBlame(repoPath, data, currentUser, modifiedTime) {
|
|
|
26
42
|
let cachedPathUri;
|
|
27
43
|
let cachedPreviousPath;
|
|
28
44
|
let cachedPreviousPathUri;
|
|
45
|
+
const unquotePath = createPathUnquoter();
|
|
46
|
+
const unquotePreviousPath = createPathUnquoter();
|
|
29
47
|
const authors = /* @__PURE__ */ new Map();
|
|
30
48
|
const commits = /* @__PURE__ */ new Map();
|
|
31
49
|
const lines = [];
|
|
@@ -68,7 +86,7 @@ function parseGitBlame(repoPath, data, currentUser, modifiedTime) {
|
|
|
68
86
|
} else if (keyLen === 12) entry.committerTimeZone = line.substring(valueStart);
|
|
69
87
|
break;
|
|
70
88
|
case 102: {
|
|
71
|
-
entry.path = line.substring(valueStart);
|
|
89
|
+
entry.path = unquotePath(line.substring(valueStart));
|
|
72
90
|
const entryPath = entry.path;
|
|
73
91
|
const isUncommittedEntry = entry.sha === uncommitted;
|
|
74
92
|
let commit = commits.get(entry.sha);
|
|
@@ -146,7 +164,7 @@ function parseGitBlame(repoPath, data, currentUser, modifiedTime) {
|
|
|
146
164
|
const shaEnd = value.indexOf(" ");
|
|
147
165
|
if (shaEnd !== -1) {
|
|
148
166
|
entry.previousSha = value.substring(0, shaEnd);
|
|
149
|
-
entry.previousPath = value.substring(shaEnd + 1);
|
|
167
|
+
entry.previousPath = unquotePreviousPath(value.substring(shaEnd + 1));
|
|
150
168
|
}
|
|
151
169
|
break;
|
|
152
170
|
}
|
|
@@ -172,6 +190,8 @@ function parseGitBlame(repoPath, data, currentUser, modifiedTime) {
|
|
|
172
190
|
* as its `filename` terminator line is encountered.
|
|
173
191
|
*/
|
|
174
192
|
async function* parseGitBlameAsync(stream) {
|
|
193
|
+
const unquotePath = createPathUnquoter();
|
|
194
|
+
const unquotePreviousPath = createPathUnquoter();
|
|
175
195
|
let entry;
|
|
176
196
|
for await (const line of iterateAsyncByDelimiter(stream, "\n")) {
|
|
177
197
|
const spaceIdx = line.indexOf(" ");
|
|
@@ -211,7 +231,7 @@ async function* parseGitBlameAsync(stream) {
|
|
|
211
231
|
} else if (keyLen === 12) entry.committerTimeZone = line.substring(valueStart);
|
|
212
232
|
break;
|
|
213
233
|
case 102:
|
|
214
|
-
entry.path = line.substring(valueStart);
|
|
234
|
+
entry.path = unquotePath(line.substring(valueStart));
|
|
215
235
|
yield entry;
|
|
216
236
|
entry = void 0;
|
|
217
237
|
break;
|
|
@@ -223,7 +243,7 @@ async function* parseGitBlameAsync(stream) {
|
|
|
223
243
|
const shaEnd = value.indexOf(" ");
|
|
224
244
|
if (shaEnd !== -1) {
|
|
225
245
|
entry.previousSha = value.substring(0, shaEnd);
|
|
226
|
-
entry.previousPath = value.substring(shaEnd + 1);
|
|
246
|
+
entry.previousPath = unquotePreviousPath(value.substring(shaEnd + 1));
|
|
227
247
|
}
|
|
228
248
|
break;
|
|
229
249
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blameParser.js","names":[],"sources":["../../../../git-cli/src/parsers/blameParser.ts"],"sourcesContent":["import type { GitBlame, GitBlameAuthor } from '@gitlens/git/models/blame.js';\nimport type { GitCommitLine } from '@gitlens/git/models/commit.js';\nimport { GitCommit, GitCommitIdentity } from '@gitlens/git/models/commit.js';\nimport { GitFileChange } from '@gitlens/git/models/fileChange.js';\nimport { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport { uncommitted } from '@gitlens/git/models/revision.js';\nimport type { GitUser } from '@gitlens/git/models/user.js';\nimport { isUserMatch } from '@gitlens/git/utils/user.utils.js';\nimport { normalizePath } from '@gitlens/utils/path.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { iterateAsyncByDelimiter, iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { fileUri, joinUriPath } from '@gitlens/utils/uri.js';\n\nexport interface BlameEntry {\n\tsha: string;\n\tline: number;\n\toriginalLine: number;\n\tlineCount: number;\n\n\tauthor?: string;\n\tauthorTime?: number;\n\tauthorTimeZone?: string;\n\tauthorEmail?: string;\n\n\tcommitter?: string;\n\tcommitterTime?: number;\n\tcommitterTimeZone?: string;\n\tcommitterEmail?: string;\n\n\tpreviousSha?: string;\n\tpreviousPath?: string;\n\n\tpath?: string;\n\tsummary?: string;\n\n\tauthorCurrent?: boolean;\n\tcommitterCurrent?: boolean;\n}\n\nexport function parseGitBlame(\n\trepoPath: string,\n\tdata: string | undefined,\n\tcurrentUser: GitUser | undefined,\n\tmodifiedTime?: number,\n): GitBlame | undefined {\n\tusing sw = maybeStopWatch(`Git.parseBlame(${repoPath})`, { log: { onlyExit: true, level: 'debug' } });\n\tif (!data) {\n\t\tsw?.stop({ suffix: ` no data` });\n\t\treturn undefined;\n\t}\n\n\t// Pre-compute constants once\n\tconst normalizedRepoPath = normalizePath(repoPath);\n\tconst repoUri = fileUri(normalizedRepoPath);\n\n\t// Path normalization + URI cache (single-file blame = 1 cache entry)\n\tlet cachedPath: string | undefined;\n\tlet cachedPathUri: Uri | undefined;\n\tlet cachedPreviousPath: string | undefined;\n\tlet cachedPreviousPathUri: Uri | undefined;\n\n\tconst authors = new Map<string, GitBlameAuthor>();\n\tconst commits = new Map<string, GitCommit>();\n\tconst lines: GitCommitLine[] = [];\n\n\tlet entry: BlameEntry | undefined;\n\n\tfor (const line of iterateByDelimiter(data, '\\n')) {\n\t\tconst spaceIdx = line.indexOf(' ');\n\t\tif (spaceIdx === -1) continue;\n\n\t\tif (entry == null) {\n\t\t\t// Header line: <sha> <originalLine> <currentLine> <lineCount>\n\t\t\tconst sha = line.substring(0, spaceIdx);\n\n\t\t\tlet s = spaceIdx + 1;\n\t\t\tlet e = line.indexOf(' ', s);\n\t\t\tconst originalLine = parseInt(line.substring(s, e), 10);\n\n\t\t\ts = e + 1;\n\t\t\te = line.indexOf(' ', s);\n\t\t\tconst lineno = parseInt(line.substring(s, e), 10);\n\n\t\t\ts = e + 1;\n\t\t\tconst lineCount = parseInt(line.substring(s), 10);\n\n\t\t\tentry = { sha: sha, originalLine: originalLine, line: lineno, lineCount: lineCount };\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Dispatch on first character + key length to avoid creating key substrings\n\t\tconst keyLen = spaceIdx;\n\t\tconst valueStart = spaceIdx + 1;\n\n\t\tswitch (line.charCodeAt(0)) {\n\t\t\tcase 0x61 /* a — author* */:\n\t\t\t\tif (keyLen === 6 /* \"author\" */) {\n\t\t\t\t\tentry.author = line.substring(valueStart);\n\t\t\t\t} else if (keyLen === 11 /* \"author-mail\" | \"author-time\" */) {\n\t\t\t\t\t// Disambiguate at pos 7: 'm' (mail) vs 't' (time)\n\t\t\t\t\tif (line.charCodeAt(7) === 0x6d /* m */) {\n\t\t\t\t\t\tentry.authorEmail = parseEmail(line.substring(valueStart));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.authorTime = parseInt(line.substring(valueStart), 10) * 1000;\n\t\t\t\t\t}\n\t\t\t\t} else if (keyLen === 9 /* \"author-tz\" */) {\n\t\t\t\t\tentry.authorTimeZone = line.substring(valueStart);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 0x63 /* c — committer* */:\n\t\t\t\tif (keyLen === 9 /* \"committer\" */) {\n\t\t\t\t\tentry.committer = line.substring(valueStart);\n\t\t\t\t} else if (keyLen === 14 /* \"committer-mail\" | \"committer-time\" */) {\n\t\t\t\t\t// Disambiguate at pos 10: 'm' (mail) vs 't' (time)\n\t\t\t\t\tif (line.charCodeAt(10) === 0x6d /* m */) {\n\t\t\t\t\t\tentry.committerEmail = parseEmail(line.substring(valueStart));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.committerTime = parseInt(line.substring(valueStart), 10) * 1000;\n\t\t\t\t\t}\n\t\t\t\t} else if (keyLen === 12 /* \"committer-tz\" */) {\n\t\t\t\t\tentry.committerTimeZone = line.substring(valueStart);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 0x66 /* f — filename */: {\n\t\t\t\t// Don't trim — spaces in filenames are valid\n\t\t\t\tentry.path = line.substring(valueStart);\n\n\t\t\t\t// Assemble model immediately — no intermediate storage\n\t\t\t\tconst entryPath = entry.path;\n\t\t\t\tconst isUncommittedEntry = entry.sha === uncommitted;\n\n\t\t\t\tlet commit = commits.get(entry.sha);\n\t\t\t\tif (commit == null) {\n\t\t\t\t\tif (isUncommittedEntry) {\n\t\t\t\t\t\tentry.author = currentUser?.name ?? '';\n\t\t\t\t\t\tentry.authorCurrent = true;\n\t\t\t\t\t\tentry.authorEmail = currentUser?.email;\n\t\t\t\t\t\tentry.authorTime = modifiedTime ?? entry.authorTime ?? 0;\n\t\t\t\t\t\tentry.committer = entry.author;\n\t\t\t\t\t\tentry.committerEmail = entry.authorEmail;\n\t\t\t\t\t\tentry.committerTime = entry.authorTime;\n\t\t\t\t\t\tentry.committerCurrent = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (isUserMatch(currentUser, entry.author, entry.authorEmail)) {\n\t\t\t\t\t\t\tentry.authorCurrent = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (isUserMatch(currentUser, entry.committer, entry.committerEmail)) {\n\t\t\t\t\t\t\tentry.committerCurrent = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tlet author = authors.get(entry.author!);\n\t\t\t\t\tif (author == null) {\n\t\t\t\t\t\tauthor = { name: entry.author!, lineCount: 0, current: entry.authorCurrent };\n\t\t\t\t\t\tauthors.set(entry.author!, author);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Cache path normalization + URI\n\t\t\t\t\tif (entryPath !== cachedPath) {\n\t\t\t\t\t\tcachedPath = entryPath;\n\t\t\t\t\t\tcachedPathUri = joinUriPath(repoUri, normalizePath(entryPath));\n\t\t\t\t\t}\n\n\t\t\t\t\tlet previousPath: string | undefined;\n\t\t\t\t\tlet previousPathUri: Uri | undefined;\n\t\t\t\t\tif (entry.previousPath != null && entry.previousPath !== entryPath) {\n\t\t\t\t\t\tpreviousPath = entry.previousPath;\n\t\t\t\t\t\tif (previousPath !== cachedPreviousPath) {\n\t\t\t\t\t\t\tcachedPreviousPath = previousPath;\n\t\t\t\t\t\t\tcachedPreviousPathUri = joinUriPath(repoUri, normalizePath(previousPath));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpreviousPathUri = cachedPreviousPathUri;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst file = new GitFileChange(\n\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\tentryPath,\n\t\t\t\t\t\tGitFileIndexStatus.Modified,\n\t\t\t\t\t\tcachedPathUri!,\n\t\t\t\t\t\tpreviousPath,\n\t\t\t\t\t\tpreviousPathUri,\n\t\t\t\t\t\tentry.previousSha,\n\t\t\t\t\t);\n\n\t\t\t\t\tcommit = new GitCommit(\n\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\tentry.sha,\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tentry.author!,\n\t\t\t\t\t\t\tentry.authorEmail,\n\t\t\t\t\t\t\tnew Date(entry.authorTime!),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tentry.authorCurrent,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tentry.committer!,\n\t\t\t\t\t\t\tentry.committerEmail,\n\t\t\t\t\t\t\tnew Date(entry.committerTime!),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tentry.committerCurrent,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tentry.summary ?? '',\n\t\t\t\t\t\t[],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfiles: undefined,\n\t\t\t\t\t\t\tfiltered: {\n\t\t\t\t\t\t\t\tfiles: [file],\n\t\t\t\t\t\t\t\tpathspec: entryPath,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t[],\n\t\t\t\t\t);\n\n\t\t\t\t\tcommits.set(entry.sha, commit);\n\t\t\t\t}\n\n\t\t\t\t// Accumulate author line counts incrementally\n\t\t\t\tconst authorName = commit.author.name;\n\t\t\t\tif (authorName) {\n\t\t\t\t\tconst author = authors.get(authorName);\n\t\t\t\t\tif (author != null) {\n\t\t\t\t\t\tauthor.lineCount += entry.lineCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Build line mappings\n\t\t\t\tconst previousSha = entry.previousSha ?? commit.file?.previousSha;\n\t\t\t\tfor (let i = 0, count = entry.lineCount; i < count; i++) {\n\t\t\t\t\tconst l: GitCommitLine = {\n\t\t\t\t\t\tsha: entry.sha,\n\t\t\t\t\t\tpreviousSha: previousSha,\n\t\t\t\t\t\toriginalLine: entry.originalLine + i,\n\t\t\t\t\t\tline: entry.line + i,\n\t\t\t\t\t};\n\n\t\t\t\t\tcommit.lines.push(l);\n\t\t\t\t\tlines[l.line - 1] = l;\n\t\t\t\t}\n\n\t\t\t\tentry = undefined;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 0x73 /* s — summary */:\n\t\t\t\tentry.summary = line.substring(valueStart);\n\t\t\t\tbreak;\n\n\t\t\tcase 0x70 /* p — previous */: {\n\t\t\t\tconst value = line.substring(valueStart);\n\t\t\t\tconst shaEnd = value.indexOf(' ');\n\t\t\t\tif (shaEnd !== -1) {\n\t\t\t\t\tentry.previousSha = value.substring(0, shaEnd);\n\t\t\t\t\tentry.previousPath = value.substring(shaEnd + 1);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst sortedAuthors = new Map([...authors.entries()].sort((a, b) => b[1].lineCount - a[1].lineCount));\n\n\tsw?.stop({ suffix: ` parsed ${lines.length} lines, ${commits.size} commits` });\n\n\treturn {\n\t\trepoPath: repoPath,\n\t\tauthors: sortedAuthors,\n\t\tcommits: commits,\n\t\tlines: lines,\n\t};\n}\n\n/**\n * Async generator that yields `BlameEntry` objects as they are parsed from\n * a streaming `git blame --incremental` output. Each entry is yielded as soon\n * as its `filename` terminator line is encountered.\n */\nexport async function* parseGitBlameAsync(stream: AsyncIterable<string>): AsyncGenerator<BlameEntry> {\n\tlet entry: BlameEntry | undefined;\n\n\tfor await (const line of iterateAsyncByDelimiter(stream, '\\n')) {\n\t\tconst spaceIdx = line.indexOf(' ');\n\t\tif (spaceIdx === -1) continue;\n\n\t\tif (entry == null) {\n\t\t\tconst sha = line.substring(0, spaceIdx);\n\n\t\t\tlet s = spaceIdx + 1;\n\t\t\tlet e = line.indexOf(' ', s);\n\t\t\tconst originalLine = parseInt(line.substring(s, e), 10);\n\n\t\t\ts = e + 1;\n\t\t\te = line.indexOf(' ', s);\n\t\t\tconst lineno = parseInt(line.substring(s, e), 10);\n\n\t\t\ts = e + 1;\n\t\t\tconst lineCount = parseInt(line.substring(s), 10);\n\n\t\t\tentry = { sha: sha, originalLine: originalLine, line: lineno, lineCount: lineCount };\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst keyLen = spaceIdx;\n\t\tconst valueStart = spaceIdx + 1;\n\n\t\t// Dispatch on first character + key length to avoid creating key substrings\n\t\tswitch (line.charCodeAt(0)) {\n\t\t\tcase 0x61 /* a — author* */:\n\t\t\t\tif (keyLen === 6 /* \"author\" */) {\n\t\t\t\t\tentry.author = line.substring(valueStart);\n\t\t\t\t} else if (keyLen === 11 /* \"author-mail\" | \"author-time\" */) {\n\t\t\t\t\t// Disambiguate at pos 7: 'm' (mail) vs 't' (time)\n\t\t\t\t\tif (line.charCodeAt(7) === 0x6d /* m */) {\n\t\t\t\t\t\tentry.authorEmail = parseEmail(line.substring(valueStart));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.authorTime = parseInt(line.substring(valueStart), 10) * 1000;\n\t\t\t\t\t}\n\t\t\t\t} else if (keyLen === 9 /* \"author-tz\" */) {\n\t\t\t\t\tentry.authorTimeZone = line.substring(valueStart);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 0x63 /* c — committer* */:\n\t\t\t\tif (keyLen === 9 /* \"committer\" */) {\n\t\t\t\t\tentry.committer = line.substring(valueStart);\n\t\t\t\t} else if (keyLen === 14 /* \"committer-mail\" | \"committer-time\" */) {\n\t\t\t\t\t// Disambiguate at pos 10: 'm' (mail) vs 't' (time)\n\t\t\t\t\tif (line.charCodeAt(10) === 0x6d /* m */) {\n\t\t\t\t\t\tentry.committerEmail = parseEmail(line.substring(valueStart));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.committerTime = parseInt(line.substring(valueStart), 10) * 1000;\n\t\t\t\t\t}\n\t\t\t\t} else if (keyLen === 12 /* \"committer-tz\" */) {\n\t\t\t\t\tentry.committerTimeZone = line.substring(valueStart);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 0x66 /* f — filename */:\n\t\t\t\tentry.path = line.substring(valueStart);\n\t\t\t\tyield entry;\n\n\t\t\t\tentry = undefined;\n\t\t\t\tbreak;\n\n\t\t\tcase 0x73 /* s — summary */:\n\t\t\t\tentry.summary = line.substring(valueStart);\n\t\t\t\tbreak;\n\n\t\t\tcase 0x70 /* p — previous */: {\n\t\t\t\tconst value = line.substring(valueStart);\n\t\t\t\tconst shaEnd = value.indexOf(' ');\n\t\t\t\tif (shaEnd !== -1) {\n\t\t\t\t\tentry.previousSha = value.substring(0, shaEnd);\n\t\t\t\t\tentry.previousPath = value.substring(shaEnd + 1);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Extracts email from a value like `<user@example.com>` */\nfunction parseEmail(raw: string): string {\n\tconst lt = raw.indexOf('<');\n\tif (lt >= 0) {\n\t\tconst gt = raw.indexOf('>', lt + 1);\n\t\treturn gt > lt ? raw.substring(lt + 1, gt) : raw.substring(lt + 1);\n\t}\n\treturn raw;\n}\n"],"mappings":";;;;;;;;;;;AAwCA,SAAgB,cACf,UACA,MACA,aACA,cACuB;;;EACvB,MAAM,KAAA,YAAA,EAAK,eAAe,kBAAkB,SAAS,IAAI,EAAE,KAAK;GAAE,UAAU;GAAM,OAAO;EAAQ,EAAE,CAAC,CAAA;EACpG,IAAI,CAAC,MAAM;GACV,IAAI,KAAK,EAAE,QAAQ,WAAW,CAAC;GAC/B;EACD;EAGA,MAAM,qBAAqB,cAAc,QAAQ;EACjD,MAAM,UAAU,QAAQ,kBAAkB;EAG1C,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EAEJ,MAAM,0BAAU,IAAI,IAA4B;EAChD,MAAM,0BAAU,IAAI,IAAuB;EAC3C,MAAM,QAAyB,CAAC;EAEhC,IAAI;EAEJ,KAAK,MAAM,QAAQ,mBAAmB,MAAM,IAAI,GAAG;GAClD,MAAM,WAAW,KAAK,QAAQ,GAAG;GACjC,IAAI,aAAa,IAAI;GAErB,IAAI,SAAS,MAAM;IAElB,MAAM,MAAM,KAAK,UAAU,GAAG,QAAQ;IAEtC,IAAI,IAAI,WAAW;IACnB,IAAI,IAAI,KAAK,QAAQ,KAAK,CAAC;IAC3B,MAAM,eAAe,SAAS,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE;IAEtD,IA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AAyB;IAC7B,MAAM,QAAQ,KAAK,UAAU,UAAU;IACvC,MAAM,SAAS,MAAM,QAAQ,GAAG;IAChC,IAAI,WAAW,IAAI;KAClB,MAAM,cAAc,MAAM,UAAU,GAAG,MAAM;KAC7C,MAAM,eAAe,MAAM,UAAU,SAAS,CAAC;IAChD;IACA;GACD;EACD;CACD;AACD;;AAGA,SAAS,WAAW,KAAqB;CACxC,MAAM,KAAK,IAAI,QAAQ,GAAG;CAC1B,IAAI,MAAM,GAAG;EACZ,MAAM,KAAK,IAAI,QAAQ,KAAK,KAAK,CAAC;EAClC,OAAO,KAAK,KAAK,IAAI,UAAU,KAAK,GAAG,EAAE,IAAI,IAAI,UAAU,KAAK,CAAC;CAClE;CACA,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"blameParser.js","names":[],"sources":["../../../../git-cli/src/parsers/blameParser.ts"],"sourcesContent":["import type { GitBlame, GitBlameAuthor } from '@gitlens/git/models/blame.js';\nimport type { GitCommitLine } from '@gitlens/git/models/commit.js';\nimport { GitCommit, GitCommitIdentity } from '@gitlens/git/models/commit.js';\nimport { GitFileChange } from '@gitlens/git/models/fileChange.js';\nimport { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport { uncommitted } from '@gitlens/git/models/revision.js';\nimport type { GitUser } from '@gitlens/git/models/user.js';\nimport { isUserMatch } from '@gitlens/git/utils/user.utils.js';\nimport { normalizePath } from '@gitlens/utils/path.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { iterateAsyncByDelimiter, iterateByDelimiter, unquoteCString } from '@gitlens/utils/string.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { fileUri, joinUriPath } from '@gitlens/utils/uri.js';\n\nexport interface BlameEntry {\n\tsha: string;\n\tline: number;\n\toriginalLine: number;\n\tlineCount: number;\n\n\tauthor?: string;\n\tauthorTime?: number;\n\tauthorTimeZone?: string;\n\tauthorEmail?: string;\n\n\tcommitter?: string;\n\tcommitterTime?: number;\n\tcommitterTimeZone?: string;\n\tcommitterEmail?: string;\n\n\tpreviousSha?: string;\n\tpreviousPath?: string;\n\n\tpath?: string;\n\tsummary?: string;\n\n\tauthorCurrent?: boolean;\n\tcommitterCurrent?: boolean;\n}\n\n/**\n * Decodes one kind of blame file name, remembering the last: git repeats the file name (and the one it was renamed from)\n * in every chunk, so a name it quoted would otherwise be decoded again each time\n */\nfunction createPathUnquoter(): (raw: string) => string {\n\tlet lastRaw: string | undefined;\n\tlet lastPath = '';\n\treturn raw => {\n\t\tif (raw.charCodeAt(0) !== 0x22 /* \" */) return raw;\n\n\t\tif (raw !== lastRaw) {\n\t\t\tlastRaw = raw;\n\t\t\tlastPath = unquoteCString(raw);\n\t\t}\n\t\treturn lastPath;\n\t};\n}\n\nexport function parseGitBlame(\n\trepoPath: string,\n\tdata: string | undefined,\n\tcurrentUser: GitUser | undefined,\n\tmodifiedTime?: number,\n): GitBlame | undefined {\n\tusing sw = maybeStopWatch(`Git.parseBlame(${repoPath})`, { log: { onlyExit: true, level: 'debug' } });\n\tif (!data) {\n\t\tsw?.stop({ suffix: ` no data` });\n\t\treturn undefined;\n\t}\n\n\t// Pre-compute constants once\n\tconst normalizedRepoPath = normalizePath(repoPath);\n\tconst repoUri = fileUri(normalizedRepoPath);\n\n\t// Path normalization + URI cache (single-file blame = 1 cache entry)\n\tlet cachedPath: string | undefined;\n\tlet cachedPathUri: Uri | undefined;\n\tlet cachedPreviousPath: string | undefined;\n\tlet cachedPreviousPathUri: Uri | undefined;\n\n\tconst unquotePath = createPathUnquoter();\n\tconst unquotePreviousPath = createPathUnquoter();\n\tconst authors = new Map<string, GitBlameAuthor>();\n\tconst commits = new Map<string, GitCommit>();\n\tconst lines: GitCommitLine[] = [];\n\n\tlet entry: BlameEntry | undefined;\n\n\tfor (const line of iterateByDelimiter(data, '\\n')) {\n\t\tconst spaceIdx = line.indexOf(' ');\n\t\tif (spaceIdx === -1) continue;\n\n\t\tif (entry == null) {\n\t\t\t// Header line: <sha> <originalLine> <currentLine> <lineCount>\n\t\t\tconst sha = line.substring(0, spaceIdx);\n\n\t\t\tlet s = spaceIdx + 1;\n\t\t\tlet e = line.indexOf(' ', s);\n\t\t\tconst originalLine = parseInt(line.substring(s, e), 10);\n\n\t\t\ts = e + 1;\n\t\t\te = line.indexOf(' ', s);\n\t\t\tconst lineno = parseInt(line.substring(s, e), 10);\n\n\t\t\ts = e + 1;\n\t\t\tconst lineCount = parseInt(line.substring(s), 10);\n\n\t\t\tentry = { sha: sha, originalLine: originalLine, line: lineno, lineCount: lineCount };\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Dispatch on first character + key length to avoid creating key substrings\n\t\tconst keyLen = spaceIdx;\n\t\tconst valueStart = spaceIdx + 1;\n\n\t\tswitch (line.charCodeAt(0)) {\n\t\t\tcase 0x61 /* a — author* */:\n\t\t\t\tif (keyLen === 6 /* \"author\" */) {\n\t\t\t\t\tentry.author = line.substring(valueStart);\n\t\t\t\t} else if (keyLen === 11 /* \"author-mail\" | \"author-time\" */) {\n\t\t\t\t\t// Disambiguate at pos 7: 'm' (mail) vs 't' (time)\n\t\t\t\t\tif (line.charCodeAt(7) === 0x6d /* m */) {\n\t\t\t\t\t\tentry.authorEmail = parseEmail(line.substring(valueStart));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.authorTime = parseInt(line.substring(valueStart), 10) * 1000;\n\t\t\t\t\t}\n\t\t\t\t} else if (keyLen === 9 /* \"author-tz\" */) {\n\t\t\t\t\tentry.authorTimeZone = line.substring(valueStart);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 0x63 /* c — committer* */:\n\t\t\t\tif (keyLen === 9 /* \"committer\" */) {\n\t\t\t\t\tentry.committer = line.substring(valueStart);\n\t\t\t\t} else if (keyLen === 14 /* \"committer-mail\" | \"committer-time\" */) {\n\t\t\t\t\t// Disambiguate at pos 10: 'm' (mail) vs 't' (time)\n\t\t\t\t\tif (line.charCodeAt(10) === 0x6d /* m */) {\n\t\t\t\t\t\tentry.committerEmail = parseEmail(line.substring(valueStart));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.committerTime = parseInt(line.substring(valueStart), 10) * 1000;\n\t\t\t\t\t}\n\t\t\t\t} else if (keyLen === 12 /* \"committer-tz\" */) {\n\t\t\t\t\tentry.committerTimeZone = line.substring(valueStart);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 0x66 /* f — filename */: {\n\t\t\t\t// Don't trim — spaces in filenames are valid\n\t\t\t\tentry.path = unquotePath(line.substring(valueStart));\n\n\t\t\t\t// Assemble model immediately — no intermediate storage\n\t\t\t\tconst entryPath = entry.path;\n\t\t\t\tconst isUncommittedEntry = entry.sha === uncommitted;\n\n\t\t\t\tlet commit = commits.get(entry.sha);\n\t\t\t\tif (commit == null) {\n\t\t\t\t\tif (isUncommittedEntry) {\n\t\t\t\t\t\tentry.author = currentUser?.name ?? '';\n\t\t\t\t\t\tentry.authorCurrent = true;\n\t\t\t\t\t\tentry.authorEmail = currentUser?.email;\n\t\t\t\t\t\tentry.authorTime = modifiedTime ?? entry.authorTime ?? 0;\n\t\t\t\t\t\tentry.committer = entry.author;\n\t\t\t\t\t\tentry.committerEmail = entry.authorEmail;\n\t\t\t\t\t\tentry.committerTime = entry.authorTime;\n\t\t\t\t\t\tentry.committerCurrent = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (isUserMatch(currentUser, entry.author, entry.authorEmail)) {\n\t\t\t\t\t\t\tentry.authorCurrent = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (isUserMatch(currentUser, entry.committer, entry.committerEmail)) {\n\t\t\t\t\t\t\tentry.committerCurrent = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tlet author = authors.get(entry.author!);\n\t\t\t\t\tif (author == null) {\n\t\t\t\t\t\tauthor = { name: entry.author!, lineCount: 0, current: entry.authorCurrent };\n\t\t\t\t\t\tauthors.set(entry.author!, author);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Cache path normalization + URI\n\t\t\t\t\tif (entryPath !== cachedPath) {\n\t\t\t\t\t\tcachedPath = entryPath;\n\t\t\t\t\t\tcachedPathUri = joinUriPath(repoUri, normalizePath(entryPath));\n\t\t\t\t\t}\n\n\t\t\t\t\tlet previousPath: string | undefined;\n\t\t\t\t\tlet previousPathUri: Uri | undefined;\n\t\t\t\t\tif (entry.previousPath != null && entry.previousPath !== entryPath) {\n\t\t\t\t\t\tpreviousPath = entry.previousPath;\n\t\t\t\t\t\tif (previousPath !== cachedPreviousPath) {\n\t\t\t\t\t\t\tcachedPreviousPath = previousPath;\n\t\t\t\t\t\t\tcachedPreviousPathUri = joinUriPath(repoUri, normalizePath(previousPath));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpreviousPathUri = cachedPreviousPathUri;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst file = new GitFileChange(\n\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\tentryPath,\n\t\t\t\t\t\tGitFileIndexStatus.Modified,\n\t\t\t\t\t\tcachedPathUri!,\n\t\t\t\t\t\tpreviousPath,\n\t\t\t\t\t\tpreviousPathUri,\n\t\t\t\t\t\tentry.previousSha,\n\t\t\t\t\t);\n\n\t\t\t\t\tcommit = new GitCommit(\n\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\tentry.sha,\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tentry.author!,\n\t\t\t\t\t\t\tentry.authorEmail,\n\t\t\t\t\t\t\tnew Date(entry.authorTime!),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tentry.authorCurrent,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tentry.committer!,\n\t\t\t\t\t\t\tentry.committerEmail,\n\t\t\t\t\t\t\tnew Date(entry.committerTime!),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tentry.committerCurrent,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tentry.summary ?? '',\n\t\t\t\t\t\t[],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfiles: undefined,\n\t\t\t\t\t\t\tfiltered: {\n\t\t\t\t\t\t\t\tfiles: [file],\n\t\t\t\t\t\t\t\tpathspec: entryPath,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t[],\n\t\t\t\t\t);\n\n\t\t\t\t\tcommits.set(entry.sha, commit);\n\t\t\t\t}\n\n\t\t\t\t// Accumulate author line counts incrementally\n\t\t\t\tconst authorName = commit.author.name;\n\t\t\t\tif (authorName) {\n\t\t\t\t\tconst author = authors.get(authorName);\n\t\t\t\t\tif (author != null) {\n\t\t\t\t\t\tauthor.lineCount += entry.lineCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Build line mappings\n\t\t\t\tconst previousSha = entry.previousSha ?? commit.file?.previousSha;\n\t\t\t\tfor (let i = 0, count = entry.lineCount; i < count; i++) {\n\t\t\t\t\tconst l: GitCommitLine = {\n\t\t\t\t\t\tsha: entry.sha,\n\t\t\t\t\t\tpreviousSha: previousSha,\n\t\t\t\t\t\toriginalLine: entry.originalLine + i,\n\t\t\t\t\t\tline: entry.line + i,\n\t\t\t\t\t};\n\n\t\t\t\t\tcommit.lines.push(l);\n\t\t\t\t\tlines[l.line - 1] = l;\n\t\t\t\t}\n\n\t\t\t\tentry = undefined;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 0x73 /* s — summary */:\n\t\t\t\tentry.summary = line.substring(valueStart);\n\t\t\t\tbreak;\n\n\t\t\tcase 0x70 /* p — previous */: {\n\t\t\t\tconst value = line.substring(valueStart);\n\t\t\t\tconst shaEnd = value.indexOf(' ');\n\t\t\t\tif (shaEnd !== -1) {\n\t\t\t\t\tentry.previousSha = value.substring(0, shaEnd);\n\t\t\t\t\tentry.previousPath = unquotePreviousPath(value.substring(shaEnd + 1));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst sortedAuthors = new Map([...authors.entries()].sort((a, b) => b[1].lineCount - a[1].lineCount));\n\n\tsw?.stop({ suffix: ` parsed ${lines.length} lines, ${commits.size} commits` });\n\n\treturn {\n\t\trepoPath: repoPath,\n\t\tauthors: sortedAuthors,\n\t\tcommits: commits,\n\t\tlines: lines,\n\t};\n}\n\n/**\n * Async generator that yields `BlameEntry` objects as they are parsed from\n * a streaming `git blame --incremental` output. Each entry is yielded as soon\n * as its `filename` terminator line is encountered.\n */\nexport async function* parseGitBlameAsync(stream: AsyncIterable<string>): AsyncGenerator<BlameEntry> {\n\tconst unquotePath = createPathUnquoter();\n\tconst unquotePreviousPath = createPathUnquoter();\n\tlet entry: BlameEntry | undefined;\n\n\tfor await (const line of iterateAsyncByDelimiter(stream, '\\n')) {\n\t\tconst spaceIdx = line.indexOf(' ');\n\t\tif (spaceIdx === -1) continue;\n\n\t\tif (entry == null) {\n\t\t\tconst sha = line.substring(0, spaceIdx);\n\n\t\t\tlet s = spaceIdx + 1;\n\t\t\tlet e = line.indexOf(' ', s);\n\t\t\tconst originalLine = parseInt(line.substring(s, e), 10);\n\n\t\t\ts = e + 1;\n\t\t\te = line.indexOf(' ', s);\n\t\t\tconst lineno = parseInt(line.substring(s, e), 10);\n\n\t\t\ts = e + 1;\n\t\t\tconst lineCount = parseInt(line.substring(s), 10);\n\n\t\t\tentry = { sha: sha, originalLine: originalLine, line: lineno, lineCount: lineCount };\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst keyLen = spaceIdx;\n\t\tconst valueStart = spaceIdx + 1;\n\n\t\t// Dispatch on first character + key length to avoid creating key substrings\n\t\tswitch (line.charCodeAt(0)) {\n\t\t\tcase 0x61 /* a — author* */:\n\t\t\t\tif (keyLen === 6 /* \"author\" */) {\n\t\t\t\t\tentry.author = line.substring(valueStart);\n\t\t\t\t} else if (keyLen === 11 /* \"author-mail\" | \"author-time\" */) {\n\t\t\t\t\t// Disambiguate at pos 7: 'm' (mail) vs 't' (time)\n\t\t\t\t\tif (line.charCodeAt(7) === 0x6d /* m */) {\n\t\t\t\t\t\tentry.authorEmail = parseEmail(line.substring(valueStart));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.authorTime = parseInt(line.substring(valueStart), 10) * 1000;\n\t\t\t\t\t}\n\t\t\t\t} else if (keyLen === 9 /* \"author-tz\" */) {\n\t\t\t\t\tentry.authorTimeZone = line.substring(valueStart);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 0x63 /* c — committer* */:\n\t\t\t\tif (keyLen === 9 /* \"committer\" */) {\n\t\t\t\t\tentry.committer = line.substring(valueStart);\n\t\t\t\t} else if (keyLen === 14 /* \"committer-mail\" | \"committer-time\" */) {\n\t\t\t\t\t// Disambiguate at pos 10: 'm' (mail) vs 't' (time)\n\t\t\t\t\tif (line.charCodeAt(10) === 0x6d /* m */) {\n\t\t\t\t\t\tentry.committerEmail = parseEmail(line.substring(valueStart));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.committerTime = parseInt(line.substring(valueStart), 10) * 1000;\n\t\t\t\t\t}\n\t\t\t\t} else if (keyLen === 12 /* \"committer-tz\" */) {\n\t\t\t\t\tentry.committerTimeZone = line.substring(valueStart);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 0x66 /* f — filename */:\n\t\t\t\tentry.path = unquotePath(line.substring(valueStart));\n\t\t\t\tyield entry;\n\n\t\t\t\tentry = undefined;\n\t\t\t\tbreak;\n\n\t\t\tcase 0x73 /* s — summary */:\n\t\t\t\tentry.summary = line.substring(valueStart);\n\t\t\t\tbreak;\n\n\t\t\tcase 0x70 /* p — previous */: {\n\t\t\t\tconst value = line.substring(valueStart);\n\t\t\t\tconst shaEnd = value.indexOf(' ');\n\t\t\t\tif (shaEnd !== -1) {\n\t\t\t\t\tentry.previousSha = value.substring(0, shaEnd);\n\t\t\t\t\tentry.previousPath = unquotePreviousPath(value.substring(shaEnd + 1));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Extracts email from a value like `<user@example.com>` */\nfunction parseEmail(raw: string): string {\n\tconst lt = raw.indexOf('<');\n\tif (lt >= 0) {\n\t\tconst gt = raw.indexOf('>', lt + 1);\n\t\treturn gt > lt ? raw.substring(lt + 1, gt) : raw.substring(lt + 1);\n\t}\n\treturn raw;\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4CA,SAAS,qBAA8C;CACtD,IAAI;CACJ,IAAI,WAAW;CACf,QAAO,QAAO;EACb,IAAI,IAAI,WAAW,CAAC,MAAM,IAAc,OAAO;EAE/C,IAAI,QAAQ,SAAS;GACpB,UAAU;GACV,WAAW,eAAe,GAAG;EAC9B;EACA,OAAO;CACR;AACD;AAEA,SAAgB,cACf,UACA,MACA,aACA,cACuB;;;EACvB,MAAM,KAAA,YAAA,EAAK,eAAe,kBAAkB,SAAS,IAAI,EAAE,KAAK;GAAE,UAAU;GAAM,OAAO;EAAQ,EAAE,CAAC,CAAA;EACpG,IAAI,CAAC,MAAM;GACV,IAAI,KAAK,EAAE,QAAQ,WAAW,CAAC;GAC/B;EACD;EAGA,MAAM,qBAAqB,cAAc,QAAQ;EACjD,MAAM,UAAU,QAAQ,kBAAkB;EAG1C,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EAEJ,MAAM,cAAc,mBAAmB;EACvC,MAAM,sBAAsB,mBAAmB;EAC/C,MAAM,0BAAU,IAAI,IAA4B;EAChD,MAAM,0BAAU,IAAI,IAAuB;EAC3C,MAAM,QAAyB,CAAC;EAEhC,IAAI;EAEJ,KAAK,MAAM,QAAQ,mBAAmB,MAAM,IAAI,GAAG;GAClD,MAAM,WAAW,KAAK,QAAQ,GAAG;GACjC,IAAI,aAAa,IAAI;GAErB,IAAI,SAAS,MAAM;IAElB,MAAM,MAAM,KAAK,UAAU,GAAG,QAAQ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IAAI;IAEnE,OAAO,IAAI,WAAW,IACrB,MAAM,oBAAoB,KAAK,UAAU,UAAU;IAEpD;GAED,KAAK;IACJ,MAAM,OAAO,YAAY,KAAK,UAAU,UAAU,CAAC;IACnD,MAAM;IAEN,QAAQ,KAAA;IACR;GAED,KAAK;IACJ,MAAM,UAAU,KAAK,UAAU,UAAU;IACzC;GAED,KAAK,KAAyB;IAC7B,MAAM,QAAQ,KAAK,UAAU,UAAU;IACvC,MAAM,SAAS,MAAM,QAAQ,GAAG;IAChC,IAAI,WAAW,IAAI;KAClB,MAAM,cAAc,MAAM,UAAU,GAAG,MAAM;KAC7C,MAAM,eAAe,oBAAoB,MAAM,UAAU,SAAS,CAAC,CAAC;IACrE;IACA;GACD;EACD;CACD;AACD;;AAGA,SAAS,WAAW,KAAqB;CACxC,MAAM,KAAK,IAAI,QAAQ,GAAG;CAC1B,IAAI,MAAM,GAAG;EACZ,MAAM,KAAK,IAAI,QAAQ,KAAK,KAAK,CAAC;EAClC,OAAO,KAAK,KAAK,IAAI,UAAU,KAAK,GAAG,EAAE,IAAI,IAAI,UAAU,KAAK,CAAC;CAClE;CACA,OAAO;AACR"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { flattenString, iterateAsyncByDelimiter, iterateByDelimiter } from "../../utils/string.js";
|
|
1
|
+
import { flattenString, iterateAsyncByDelimiter, iterateByDelimiter, unquoteCString } from "../../utils/string.js";
|
|
2
2
|
import { joinPaths, normalizePath } from "../../utils/path.js";
|
|
3
3
|
import { maybeStopWatch } from "../../utils/stopwatch.js";
|
|
4
4
|
import _usingCtx from "../../_virtual/@oxc-project+runtime/helpers/esm/usingCtx.js";
|
|
5
|
-
import { diffHunkRegex,
|
|
5
|
+
import { diffHunkRegex, parseDiffFilePaths, parseQuotedRenameOrCopyPaths } from "../../git/parsers/diffParser.js";
|
|
6
6
|
//#region ../git-cli/src/parsers/logParser.ts
|
|
7
7
|
const commitsMapping = {
|
|
8
8
|
sha: "%H",
|
|
@@ -361,13 +361,13 @@ function createLogParserWithFilesAndStats(mapping) {
|
|
|
361
361
|
let originalPath;
|
|
362
362
|
const pathTabIndex = pathPart.indexOf(" ");
|
|
363
363
|
if ((status === "R" || status === "C") && pathTabIndex !== -1) {
|
|
364
|
-
originalPath = pathPart.substring(0, pathTabIndex);
|
|
365
|
-
path = pathPart.substring(pathTabIndex + 1);
|
|
366
|
-
} else path = pathPart;
|
|
367
|
-
infoMap.set(path
|
|
364
|
+
originalPath = unquoteCString(pathPart.substring(0, pathTabIndex).trim());
|
|
365
|
+
path = unquoteCString(pathPart.substring(pathTabIndex + 1).trim());
|
|
366
|
+
} else path = unquoteCString(pathPart.trim());
|
|
367
|
+
infoMap.set(path, {
|
|
368
368
|
mode: newMode,
|
|
369
369
|
status,
|
|
370
|
-
originalPath
|
|
370
|
+
originalPath,
|
|
371
371
|
oid,
|
|
372
372
|
previousOid
|
|
373
373
|
});
|
|
@@ -388,13 +388,13 @@ function createLogParserWithFilesAndStats(mapping) {
|
|
|
388
388
|
let path = line.substring(endIndex + 1);
|
|
389
389
|
let originalPath;
|
|
390
390
|
({path, originalPath} = parseCopyOrRename(path, false));
|
|
391
|
-
const info = infoMap.get(path
|
|
391
|
+
const info = infoMap.get(path);
|
|
392
392
|
const status = info?.status ?? (originalPath ? "R" : "M");
|
|
393
393
|
if (info?.originalPath) originalPath = info.originalPath;
|
|
394
394
|
const file = {
|
|
395
395
|
status,
|
|
396
|
-
path
|
|
397
|
-
originalPath
|
|
396
|
+
path,
|
|
397
|
+
originalPath,
|
|
398
398
|
additions: additions === "-" ? 0 : parseInt(additions, 10) || 0,
|
|
399
399
|
deletions: deletions === "-" ? 0 : parseInt(deletions, 10) || 0,
|
|
400
400
|
mode: info?.mode,
|
|
@@ -575,7 +575,7 @@ function createLogParserWithFileSummary(mapping) {
|
|
|
575
575
|
}
|
|
576
576
|
startIndex = line.indexOf(" ", 13);
|
|
577
577
|
if (startIndex > -1) {
|
|
578
|
-
path = line.substring(startIndex + 1);
|
|
578
|
+
path = unquoteCString(line.substring(startIndex + 1));
|
|
579
579
|
files.push({
|
|
580
580
|
path,
|
|
581
581
|
status
|
|
@@ -637,7 +637,16 @@ function createLogParserWithFileSummary(mapping) {
|
|
|
637
637
|
parse
|
|
638
638
|
};
|
|
639
639
|
}
|
|
640
|
-
|
|
640
|
+
/**
|
|
641
|
+
* Reads a numstat or summary name, or the two names of a rename or copy, trimmed as git wrote them: an unquoted name
|
|
642
|
+
* is trimmed, while a quoted one keeps the whitespace inside its quotes
|
|
643
|
+
*/
|
|
644
|
+
function parseCopyOrRename(field, stripPercentage) {
|
|
645
|
+
const path = field.trim();
|
|
646
|
+
if (path.includes("\"")) {
|
|
647
|
+
const quoted = parseQuotedRenameOrCopyPaths(path, stripPercentage);
|
|
648
|
+
if (quoted != null) return quoted;
|
|
649
|
+
}
|
|
641
650
|
const renameIndex = path.indexOf(" => ");
|
|
642
651
|
if (renameIndex === -1) return { path };
|
|
643
652
|
let hasBraces = true;
|
|
@@ -708,8 +717,9 @@ function createLogParserWithPatch(mapping) {
|
|
|
708
717
|
const lines = iterateByDelimiter(content, "\n");
|
|
709
718
|
let line = lines.next();
|
|
710
719
|
if (line.done) return void 0;
|
|
711
|
-
|
|
712
|
-
|
|
720
|
+
if (!content.startsWith("diff --git ")) return void 0;
|
|
721
|
+
const paths = parseDiffFilePaths(content);
|
|
722
|
+
if (paths == null) return void 0;
|
|
713
723
|
while (!line.done && !line.value.startsWith("@@ ")) line = lines.next();
|
|
714
724
|
const rangeMatch = line.value.match(diffHunkRegex);
|
|
715
725
|
let range;
|
|
@@ -729,9 +739,9 @@ function createLogParserWithPatch(mapping) {
|
|
|
729
739
|
} : void 0;
|
|
730
740
|
}
|
|
731
741
|
return {
|
|
732
|
-
status:
|
|
733
|
-
path:
|
|
734
|
-
originalPath:
|
|
742
|
+
status: "M",
|
|
743
|
+
path: paths.path,
|
|
744
|
+
originalPath: void 0,
|
|
735
745
|
range,
|
|
736
746
|
originalRange
|
|
737
747
|
};
|
|
@@ -970,7 +980,7 @@ function createLogParserWithFiles(mapping) {
|
|
|
970
980
|
for (const line of iterateByDelimiter(content, "\n")) {
|
|
971
981
|
const trimmed = line.trim();
|
|
972
982
|
if (!trimmed) continue;
|
|
973
|
-
files.push({ path: trimmed });
|
|
983
|
+
files.push({ path: unquoteCString(trimmed) });
|
|
974
984
|
}
|
|
975
985
|
return files;
|
|
976
986
|
}
|
|
@@ -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// `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,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;CA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AA;GAED,MAAM,UAAU,wBAAwB,QAAQ,SAAS;GAEzD,IAAI,QAAQ;GACZ,IAAI;GACJ,IAAI;GAEJ,WAAW,MAAM,UAAU,SAAS;IACnC,IAAI,CAAC,OAAO,QAAQ;IAEpB;IACA,QAAQ,CAAC;IACT,SAAS,mBAAmB,QAAQ,QAAQ;IAE5C,IAAI,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, parseDiffFilePaths, parseQuotedRenameOrCopyPaths } from '@gitlens/git/parsers/diffParser.js';\nimport { joinPaths, normalizePath } from '@gitlens/utils/path.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { flattenString, iterateAsyncByDelimiter, iterateByDelimiter, unquoteCString } from '@gitlens/utils/string.js';\nimport type { ExtractAll } from '@gitlens/utils/types.js';\n\nconst commitsMapping = {\n\tsha: '%H',\n\tauthor: '%aN',\n\tauthorEmail: '%aE',\n\tauthorDate: '%at',\n\tcommitter: '%cN',\n\tcommitterEmail: '%cE',\n\tcommitterDate: '%ct',\n\tparents: '%P',\n\ttips: '%D',\n\tmessage: '%B',\n};\n\nexport type CommitsLogParser = LogParser<typeof commitsMapping>;\nlet _commitsParser: CommitsLogParser | undefined;\nexport type CommitsWithFilesLogParser = LogParserWithFilesAndStats<typeof commitsMapping>;\nlet _commitsWithFilesParser: CommitsWithFilesLogParser | undefined;\nexport type CommitsInFileRangeLogParser = LogParserWithFiles<typeof commitsMapping>;\nlet _commitsInFileRangeParser: CommitsInFileRangeLogParser | undefined;\n\nexport type ParsedCommit =\n\t| LogParsedEntry<typeof commitsMapping>\n\t| LogParsedEntryWithFiles<typeof commitsMapping>\n\t| LogParsedEntryWithFilesAndStats<typeof commitsMapping>;\n\nexport function getCommitsLogParser(\n\tincludeFiles: boolean,\n\tinFileRange?: boolean,\n): CommitsLogParser | CommitsWithFilesLogParser | CommitsInFileRangeLogParser {\n\tif (inFileRange) {\n\t\t_commitsInFileRangeParser ??= createLogParserWithPatch(commitsMapping);\n\t\treturn _commitsInFileRangeParser;\n\t}\n\n\tif (includeFiles) {\n\t\t_commitsWithFilesParser ??= createLogParserWithFilesAndStats(commitsMapping);\n\t\treturn _commitsWithFilesParser;\n\t}\n\n\t_commitsParser ??= createLogParser(commitsMapping);\n\treturn _commitsParser;\n}\n\nconst contributorsMapping = { sha: '%H', author: '%aN', email: '%aE', date: '%at', message: '%B' };\n\ntype ContributorsLogParser = LogParser<typeof contributorsMapping>;\nlet _contributorsParser: ContributorsLogParser | undefined;\ntype ContributorsWithStatsLogParser = LogParserWithStats<typeof contributorsMapping>;\nlet _contributorsWithStatsParser: ContributorsWithStatsLogParser | undefined;\n\nexport function getContributorsLogParser(stats?: boolean): ContributorsLogParser | ContributorsWithStatsLogParser {\n\tif (stats) {\n\t\t_contributorsWithStatsParser ??= createLogParserWithStats(contributorsMapping);\n\t\treturn _contributorsWithStatsParser;\n\t}\n\n\t_contributorsParser ??= createLogParser(contributorsMapping);\n\treturn _contributorsParser;\n}\n\nconst graphMapping = {\n\tsha: '%H',\n\tauthor: '%aN',\n\tauthorEmail: '%aE',\n\tauthorDate: '%at',\n\tcommitterDate: '%ct',\n\tparents: '%P',\n\ttips: '%D',\n\tmessage: '%B',\n};\n\nexport type GraphLogParser = LogParser<typeof graphMapping>;\nlet _graphParser: GraphLogParser | undefined;\ntype GraphWithStatsLogParser = LogParserWithStats<typeof graphMapping>;\nlet _graphWithStatsParser: GraphWithStatsLogParser | undefined;\n\n/**\n * Prints `tips` as full refnames (`HEAD -> refs/heads/main`, `refs/remotes/origin/main`, `tag: refs/tags/v1`), whatever\n * `log.decorate` says, since short names can't tell a local branch from a remote-tracking ref of the same name\n */\nexport function getGraphParser(stats?: boolean): GraphLogParser | GraphWithStatsLogParser {\n\tif (stats) {\n\t\tif (_graphWithStatsParser == null) {\n\t\t\t_graphWithStatsParser = createLogParserWithStats(graphMapping);\n\t\t\t_graphWithStatsParser.arguments.push('--decorate=full');\n\t\t}\n\t\treturn _graphWithStatsParser;\n\t}\n\n\tif (_graphParser == null) {\n\t\t_graphParser = createLogParser(graphMapping);\n\t\t_graphParser.arguments.push('--decorate=full');\n\t}\n\treturn _graphParser;\n}\n\ntype ShaLogParser = Parser<string>;\nlet _shaParser: ShaLogParser | undefined;\n\nexport function getShaLogParser(): ShaLogParser {\n\t_shaParser ??= createLogParserSingle('%H');\n\treturn _shaParser;\n}\n\nconst shaAndDateMapping = { sha: '%H', authorDate: '%at', committerDate: '%ct' };\nconst shaAndDateAndTipsMapping = { sha: '%H', authorDate: '%at', committerDate: '%ct', tips: '%D' };\n\ntype ShaAndDatesLogParser = LogParser<typeof shaAndDateMapping & { tips?: string }>;\nlet _shaAndDatesParser: ShaAndDatesLogParser | undefined;\ntype ShaAndDatesAndTipsLogParser = LogParser<typeof shaAndDateAndTipsMapping>;\nlet _shaAndDatesAndTipsParser: ShaAndDatesAndTipsLogParser | undefined;\n\nexport function getShaAndDatesLogParser(includeTips?: boolean): ShaAndDatesLogParser | ShaAndDatesAndTipsLogParser {\n\tif (includeTips) {\n\t\t_shaAndDatesAndTipsParser ??= createLogParser(shaAndDateAndTipsMapping);\n\t\treturn _shaAndDatesAndTipsParser;\n\t}\n\n\t_shaAndDatesParser ??= createLogParser(shaAndDateMapping);\n\treturn _shaAndDatesParser;\n}\n\ntype ShaAndDatesWithFilesLogParser = LogParserWithFiles<typeof shaAndDateMapping & { tips?: string }>;\nlet _shaAndDatesWithFilesParser: ShaAndDatesWithFilesLogParser | undefined;\n\ntype ShaAndDatesAndTipsWithFilesLogParser = LogParserWithFiles<typeof shaAndDateAndTipsMapping>;\nlet _shaAndDatesAndTipsWithFilesParser: ShaAndDatesAndTipsWithFilesLogParser | undefined;\n\nexport function getShaAndDatesWithFilesLogParser(\n\tincludeTips?: boolean,\n): ShaAndDatesWithFilesLogParser | ShaAndDatesAndTipsWithFilesLogParser {\n\tif (includeTips) {\n\t\t_shaAndDatesAndTipsWithFilesParser ??= createLogParserWithFiles(shaAndDateAndTipsMapping);\n\t\treturn _shaAndDatesAndTipsWithFilesParser;\n\t}\n\n\t_shaAndDatesWithFilesParser ??= createLogParserWithFiles(shaAndDateMapping);\n\treturn _shaAndDatesWithFilesParser;\n}\n\nconst shaMapping = { sha: '%H' };\n\ntype ShaAndFilesAndStatsLogParser = LogParserWithFilesAndStats<typeof shaMapping>;\nlet _shaAndFilesAndStatsParser: ShaAndFilesAndStatsLogParser | undefined;\n\nexport function getShaAndFilesAndStatsLogParser(): ShaAndFilesAndStatsLogParser {\n\t_shaAndFilesAndStatsParser ??= createLogParserWithFilesAndStats(shaMapping);\n\treturn _shaAndFilesAndStatsParser;\n}\n\ntype ShaAndFileRangeLogParser = LogParserWithFiles<typeof shaMapping>;\nlet _shaAndFileRangeParser: ShaAndFileRangeLogParser | undefined;\n\nexport function getShaAndFileRangeLogParser(): ShaAndFileRangeLogParser {\n\t_shaAndFileRangeParser ??= createLogParserWithPatch(shaMapping);\n\treturn _shaAndFileRangeParser;\n}\n\ntype ShaAndFileSummaryLogParser = LogParserWithFileSummary<typeof shaMapping>;\nlet _shaAndFileSummaryParser: ShaAndFileSummaryLogParser | undefined;\n\nexport function getShaAndFileSummaryLogParser(): ShaAndFileSummaryLogParser {\n\t_shaAndFileSummaryParser ??= createLogParserWithFileSummary(shaMapping);\n\treturn _shaAndFileSummaryParser;\n}\n\ntype ShaAndStatsLogParser = LogParserWithStats<typeof shaMapping>;\nlet _shaAndStatsParser: ShaAndStatsLogParser | undefined;\n\nexport function getShaAndStatsLogParser(): ShaAndStatsLogParser {\n\t_shaAndStatsParser ??= createLogParserWithStats(shaMapping);\n\treturn _shaAndStatsParser;\n}\n\nconst stashMapping = {\n\tsha: '%H',\n\tauthorDate: '%at',\n\tcommittedDate: '%ct',\n\tparents: '%P',\n\tstashName: '%gd',\n\tsummary: '%gs',\n\t// %s (commit subject) is git's authoritative `On <branch>: …` / `WIP on <branch>: …` record,\n\t// present even when the reflog message (%gs) was customized (autostash, `git stash store -m`).\n\t// Used downstream to extract `stashOnRef` reliably.\n\tcommitSubject: '%s',\n};\n\ntype StashLogParser = LogParser<typeof stashMapping>;\nlet _stashParser: StashLogParser | undefined;\ntype StashLogParserWithFiles = LogParserWithFilesAndStats<typeof stashMapping>;\nlet _stashParserWithFiles: StashLogParserWithFiles | undefined;\n\nexport type ParsedStash = LogParsedEntry<typeof stashMapping>;\nexport type ParsedStashWithFiles = LogParsedEntryWithFilesAndStats<typeof stashMapping>;\n\nexport function getStashLogParser(includeFiles?: false): StashLogParser;\nexport function getStashLogParser(includeFiles: true): StashLogParserWithFiles;\nexport function getStashLogParser(includeFiles?: boolean): StashLogParser | StashLogParserWithFiles;\nexport function getStashLogParser(includeFiles?: boolean): StashLogParser | StashLogParserWithFiles {\n\tif (includeFiles) {\n\t\t_stashParserWithFiles ??= createLogParserWithFilesAndStats(stashMapping);\n\t\treturn _stashParserWithFiles;\n\t}\n\n\t_stashParser ??= createLogParser(stashMapping);\n\treturn _stashParser;\n}\n\ntype StashFilesOnlyLogParser = LogParserWithFilesAndStats<void>;\nlet _stashFilesOnlyParser: StashFilesOnlyLogParser | undefined;\n\nexport function getStashFilesOnlyLogParser(): StashFilesOnlyLogParser {\n\t_stashFilesOnlyParser ??= createLogParserWithFilesAndStats();\n\treturn _stashFilesOnlyParser;\n}\n\n// Parser types\nexport type Parser<T> = {\n\targuments: string[];\n\tseparators: { record: string; field: string };\n\tparse: (data: string | Iterable<string> | undefined) => Generator<T> | Iterable<T>;\n\tparseAsync?: never;\n};\nexport type AsyncParser<T> = {\n\targuments: string[];\n\tseparators: { record: string; field: string };\n\tparse: (data: string | Iterable<string> | undefined) => Generator<T> | Iterable<T>;\n\tparseAsync: (stream: AsyncGenerator<string>) => AsyncGenerator<T>;\n\t/**\n\t * Like `parseAsync` but yields one ARRAY of entries per stream chunk, scanning each chunk\n\t * synchronously with plain `indexOf` (no per-field iterator machinery). Bulk consumers (the\n\t * graph walk) avoid two promise hops per record — thousands of awaited yields collapse to one\n\t * per chunk. Only the plain parser implements it; per-record `parseAsync` remains the\n\t * general-purpose path.\n\t */\n\tparseAsyncBatched?: (stream: AsyncGenerator<string>) => AsyncGenerator<T[]>;\n};\n\nexport type LogParser<T> = AsyncParser<LogParsedEntry<T>>;\ntype LogParserWithFiles<T> = AsyncParser<LogParsedEntryWithFiles<T>>;\ntype LogParserWithFilesAndStats<T> = AsyncParser<LogParsedEntryWithFilesAndStats<T>>;\ntype LogParserWithFileSummary<T> = Parser<LogParsedEntryWithFiles<T>>;\ntype LogParserWithStats<T> = AsyncParser<LogParsedEntryWithStats<T>>;\n\n// Parsed entry types\ntype LogParsedEntry<T> = { [K in keyof T]: string } & { files?: never; stats?: never };\ntype LogParsedEntryWithFiles<T> = { [K in keyof T]: string } & { files: LogParsedFile[]; stats?: never };\ntype LogParsedEntryWithFilesAndStats<T> = { [K in keyof T]: string } & {\n\tfiles: LogParsedFileWithStats[];\n\tstats: LogParsedStatsWithFilesStats;\n};\ntype LogParsedEntryWithStats<T> = { [K in keyof T]: string } & { stats: LogParsedStats };\n\n// Parsed types\nexport interface LogParsedFile {\n\tstatus?: string;\n\tpath: string;\n\toriginalPath?: string;\n\tadditions?: never;\n\tdeletions?: never;\n\trange?: LogParsedRange;\n\toriginalRange?: LogParsedRange;\n\t/** Git file mode (e.g., 100644=regular, 100755=executable, 120000=symlink, 160000=submodule) */\n\tmode?: string;\n\t/** For submodule entries (mode 160000), the commit SHA the submodule points to */\n\toid?: string;\n\t/** For submodule entries (mode 160000), the previous commit SHA */\n\tpreviousOid?: string;\n}\ntype LogParsedFileWithStats = Omit<LogParsedFile, 'additions' | 'deletions'> & {\n\tadditions: number;\n\tdeletions: number;\n};\ninterface LogParsedRange {\n\tstartLine: number;\n\tendLine: number;\n}\ninterface LogParsedStats {\n\tfiles: number;\n\tadditions: number;\n\tdeletions: number;\n}\ninterface LogParsedStatsWithFilesStats {\n\tfiles: { added: number; changed: number; deleted: number };\n\tadditions: number;\n\tdeletions: number;\n}\n\nconst recordSep = '\\x1E'; // ASCII Record Separator character\nconst recordFormatSep = '%x1E';\nconst fieldSep = '\\x1D'; // ASCII Group Separator character\nconst fieldFormatSep = '%x1D';\n\n// `push(...items)` throws a RangeError once `items` is large enough to overflow the call stack\nfunction appendAll<T>(target: T[], items: readonly T[]): void {\n\tfor (const item of items) {\n\t\ttarget.push(item);\n\t}\n}\n\n// A complete record terminates every mapped field with a field separator — a cancelled/early-closed\n// stream resolves cleanly with a truncated tail missing at least the final terminator.\nfunction isCompleteRecord(record: string, requiredFields: number): boolean {\n\tlet count = 0;\n\tlet index = -1;\n\twhile (count < requiredFields) {\n\t\tindex = record.indexOf(fieldSep, index + 1);\n\t\tif (index === -1) return false;\n\n\t\tcount++;\n\t}\n\treturn true;\n}\n\nexport function createLogParser<T extends Record<string, string>>(mapping: ExtractAll<T, string>): LogParser<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`];\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntry<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParser.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntry<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tentry = {} as unknown as LogParsedEntry<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\t\t\t\tif (fieldCount >= keys.length) continue;\n\n\t\t\t\tcount++;\n\t\t\t\tentry[keys[fieldCount++]] = field.value as T[keyof T];\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntry<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParser.parseAsync', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntry<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\t\t\t// Drop a truncated tail (cancelled/early-closed stream) instead of yielding undefined/partial fields.\n\t\t\tif (!isCompleteRecord(record, keys.length)) continue;\n\n\t\t\tentry = {} as unknown as LogParsedEntry<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\t\t\t\tif (fieldCount >= keys.length) continue;\n\n\t\t\t\tcount++;\n\t\t\t\tentry[keys[fieldCount++]] = field.value as T[keyof T];\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\t// Builds one entry from a complete record with a plain `indexOf` walk. Matches `parseAsync`'s\n\t// semantics exactly: fields beyond the mapping are ignored, and every mapped field is\n\t// terminated by a field separator (the format string appends one after each field).\n\tfunction parseRecord(record: string): LogParsedEntry<T> {\n\t\t// Fields sliced out of the record become long-lived (graph rows); flatten the record so they\n\t\t// pin a record-sized copy rather than the full walk output the record was sliced from.\n\t\trecord = flattenString(record);\n\t\tconst entry = {} as unknown as LogParsedEntry<T>;\n\t\tlet start = 0;\n\t\tfor (const key of keys) {\n\t\t\tconst end = record.indexOf(fieldSep, start);\n\t\t\tif (end === -1) break;\n\n\t\t\tentry[key] = record.substring(start, end) as T[keyof T];\n\t\t\tstart = end + 1;\n\t\t}\n\t\treturn entry;\n\t}\n\n\tasync function* parseAsyncBatched(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntry<T>[]> {\n\t\tusing sw = maybeStopWatch('Git.LogParser.parseAsyncBatched', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tlet count = 0;\n\t\tlet buffer = '';\n\t\tfor await (const chunk of stream) {\n\t\t\tbuffer += chunk;\n\n\t\t\tlet batch: LogParsedEntry<T>[] | undefined;\n\t\t\tlet start = 0;\n\t\t\twhile (true) {\n\t\t\t\tconst end = buffer.indexOf(recordSep, start);\n\t\t\t\tif (end === -1) break;\n\n\t\t\t\tif (end > start) {\n\t\t\t\t\t(batch ??= []).push(parseRecord(buffer.substring(start, end)));\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tstart = end + 1;\n\t\t\t}\n\t\t\tif (start > 0) {\n\t\t\t\tbuffer = buffer.substring(start);\n\t\t\t}\n\t\t\tif (batch != null) {\n\t\t\t\tyield batch;\n\t\t\t}\n\t\t}\n\t\t// Trailing record (the stream doesn't end with a record separator); a truncated tail from a\n\t\t// cancelled/early-closed stream is missing a field terminator and must be dropped, not parsed.\n\t\tif (buffer.length > 0 && isCompleteRecord(buffer, keys.length)) {\n\t\t\tcount++;\n\t\t\tyield [parseRecord(buffer)];\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t\tparseAsyncBatched: parseAsyncBatched,\n\t};\n}\n\nfunction createLogParserWithFilesAndStats(): LogParserWithFilesAndStats<void>;\nfunction createLogParserWithFilesAndStats<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFilesAndStats<T>;\nfunction createLogParserWithFilesAndStats<T extends Record<string, string> | void>(\n\tmapping?: ExtractAll<T, string>,\n): LogParserWithFilesAndStats<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tif (mapping != null) {\n\t\tfor (const key in mapping) {\n\t\t\tkeys.push(key);\n\t\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t\t}\n\t}\n\t// Use --raw instead of --summary to get accurate mode info for ALL files (not just creates/deletes)\n\t// This allows us to reliably detect submodules (mode 160000) even for modifications\n\tconst args = [`--format=${format}`, '--numstat', '--raw'];\n\n\tfunction parseFilesAndStats(content: string): LogParsedFileWithStats[] {\n\t\tconst files: LogParsedFileWithStats[] = [];\n\t\tif (!content?.length) return files;\n\n\t\t// Map to store info from --raw lines: path -> { mode, status, originalPath, oid?, previousOid? }\n\t\t// Raw format: :<old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\\t<path>[\\t<new_path>]\n\t\tconst infoMap = new Map<\n\t\t\tstring,\n\t\t\t{ mode: string; status: string; originalPath?: string; oid?: string; previousOid?: string }\n\t\t>();\n\n\t\tlet startIndex: number;\n\t\tlet endIndex: number;\n\n\t\t// Single pass: --raw lines come first, then --numstat lines\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tif (!line) continue;\n\n\t\t\tif (line.charCodeAt(0) === 58 /* ':' */) {\n\t\t\t\t// --raw format: :<old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\\t<path>[\\t<new_path>]\n\t\t\t\tconst tabIndex = line.indexOf('\\t');\n\t\t\t\tif (tabIndex === -1) continue;\n\n\t\t\t\t// Parse metadata using indexOf instead of split() to avoid array allocation\n\t\t\t\t// Format after ':': <old_mode> <new_mode> <old_sha> <new_sha> <status>[score]\n\n\t\t\t\t// Skip old_mode, find new_mode\n\t\t\t\tstartIndex = line.indexOf(' ') + 1;\n\t\t\t\tif (startIndex === 0) continue;\n\n\t\t\t\tendIndex = line.indexOf(' ', startIndex);\n\t\t\t\tif (endIndex === -1) continue;\n\n\t\t\t\tconst newMode = line.substring(startIndex, endIndex);\n\n\t\t\t\t// Parse old_sha and new_sha positions\n\t\t\t\tconst oldShaStart = endIndex + 1;\n\t\t\t\tconst oldShaEnd = line.indexOf(' ', oldShaStart);\n\t\t\t\tif (oldShaEnd === -1) continue;\n\n\t\t\t\tconst newShaStart = oldShaEnd + 1;\n\t\t\t\tconst newShaEnd = line.indexOf(' ', newShaStart);\n\t\t\t\tif (newShaEnd === -1) continue;\n\n\t\t\t\t// For submodules (mode 160000), capture the commit SHAs\n\t\t\t\tlet oid: string | undefined;\n\t\t\t\tlet previousOid: string | undefined;\n\t\t\t\tif (newMode === '160000') {\n\t\t\t\t\tpreviousOid = line.substring(oldShaStart, oldShaEnd);\n\t\t\t\t\toid = line.substring(newShaStart, newShaEnd);\n\t\t\t\t}\n\n\t\t\t\t// Status is first char after the last space\n\t\t\t\tstartIndex = newShaEnd;\n\t\t\t\tconst status = line.charAt(startIndex + 1);\n\n\t\t\t\t// Parse path(s) using indexOf instead of split\n\t\t\t\tconst pathPart = line.substring(tabIndex + 1);\n\t\t\t\tlet path: string;\n\t\t\t\tlet originalPath: string | undefined;\n\n\t\t\t\t// Each field is trimmed as written, to match parseCopyOrRename, which trims an unquoted name. A\n\t\t\t\t// quoted name's whitespace is inside its quotes, so it is part of the name and kept\n\t\t\t\tconst pathTabIndex = pathPart.indexOf('\\t');\n\t\t\t\tif ((status === 'R' || status === 'C') && pathTabIndex !== -1) {\n\t\t\t\t\t// For renames/copies: old_path\\tnew_path\n\t\t\t\t\toriginalPath = unquoteCString(pathPart.substring(0, pathTabIndex).trim());\n\t\t\t\t\tpath = unquoteCString(pathPart.substring(pathTabIndex + 1).trim());\n\t\t\t\t} else {\n\t\t\t\t\tpath = unquoteCString(pathPart.trim());\n\t\t\t\t}\n\n\t\t\t\tinfoMap.set(path, {\n\t\t\t\t\tmode: newMode,\n\t\t\t\t\tstatus: status,\n\t\t\t\t\toriginalPath: originalPath,\n\t\t\t\t\toid: oid,\n\t\t\t\t\tpreviousOid: previousOid,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// --numstat format: <additions>\\t<deletions>\\t<path>\n\t\t\t\t// With renames: <additions>\\t<deletions>\\t{prefix/old => new/suffix}\n\t\t\t\tendIndex = line.indexOf('\\t');\n\t\t\t\tif (endIndex === -1) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst additions = line.substring(0, endIndex);\n\n\t\t\t\tstartIndex = endIndex + 1;\n\t\t\t\tendIndex = line.indexOf('\\t', startIndex);\n\t\t\t\tif (endIndex === -1) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst deletions = line.substring(startIndex, endIndex);\n\n\t\t\t\tlet path = line.substring(endIndex + 1);\n\t\t\t\tlet originalPath: string | undefined;\n\n\t\t\t\t// Parse rename format from numstat (e.g., \"{old => new}/path\"), which comes back trimmed as --raw's is\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(path, false));\n\n\t\t\t\t// Look up --raw info for this path (keyed by the new/destination path)\n\t\t\t\tconst info = infoMap.get(path);\n\n\t\t\t\t// Use status from --raw if available; provides accurate status (A/D/M/R/C/T)\n\t\t\t\tconst status = info?.status ?? (originalPath ? 'R' : 'M');\n\n\t\t\t\t// Use originalPath from --raw if available (cleaner than numstat format)\n\t\t\t\tif (info?.originalPath) {\n\t\t\t\t\toriginalPath = info.originalPath;\n\t\t\t\t}\n\n\t\t\t\tconst file: LogParsedFileWithStats = {\n\t\t\t\t\tstatus: status,\n\t\t\t\t\tpath: path,\n\t\t\t\t\toriginalPath: originalPath,\n\t\t\t\t\tadditions: additions === '-' ? 0 : parseInt(additions, 10) || 0,\n\t\t\t\t\tdeletions: deletions === '-' ? 0 : parseInt(deletions, 10) || 0,\n\t\t\t\t\t// Store mode for consumers to derive file type (160000=submodule, 100755=executable, etc.)\n\t\t\t\t\tmode: info?.mode,\n\t\t\t\t\toid: info?.oid,\n\t\t\t\t\tpreviousOid: info?.previousOid,\n\t\t\t\t};\n\n\t\t\t\tfiles.push(file);\n\t\t\t}\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithFilesAndStats<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithFilesAndStats.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFilesAndStats<T>;\n\t\tlet files: LogParsedFileWithStats[];\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFilesAndStats<T>;\n\t\t\tfiles = [];\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFilesAndStats<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commits and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tappendAll(files, parseFilesAndStats(summary));\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentry.files = files;\n\t\t\tif (files.length) {\n\t\t\t\tentry.stats = { additions: 0, deletions: 0, files: { added: 0, deleted: 0, changed: 0 } };\n\n\t\t\t\tfor (const f of files) {\n\t\t\t\t\tif (f.additions || f.deletions) {\n\t\t\t\t\t\tentry.stats.additions += f.additions ?? 0;\n\t\t\t\t\t\tentry.stats.deletions += f.deletions ?? 0;\n\t\t\t\t\t\tif (f.status === 'A' || f.status === '?') {\n\t\t\t\t\t\t\tentry.stats.files.added++;\n\t\t\t\t\t\t} else if (f.status === 'D') {\n\t\t\t\t\t\t\tentry.stats.files.deleted++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tentry.stats.files.changed++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntryWithFilesAndStats<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithFilesAndStats.parseAsync', {\n\t\t\tlog: { onlyExit: true, level: 'debug' },\n\t\t});\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFilesAndStats<T>;\n\t\tlet files: LogParsedFileWithStats[];\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\t\t\t// Drop a truncated tail (cancelled/early-closed stream) instead of yielding undefined/partial fields.\n\t\t\tif (!isCompleteRecord(record, keys.length)) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFilesAndStats<T>;\n\t\t\tfiles = [];\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFilesAndStats<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commits and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tappendAll(files, parseFilesAndStats(summary));\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentry.files = files;\n\t\t\tif (files.length) {\n\t\t\t\tentry.stats = { additions: 0, deletions: 0, files: { added: 0, deleted: 0, changed: 0 } };\n\n\t\t\t\tfor (const f of files) {\n\t\t\t\t\tif (f.additions || f.deletions) {\n\t\t\t\t\t\tentry.stats.additions += f.additions ?? 0;\n\t\t\t\t\t\tentry.stats.deletions += f.deletions ?? 0;\n\t\t\t\t\t\tif (f.status === 'A' || f.status === '?') {\n\t\t\t\t\t\t\tentry.stats.files.added++;\n\t\t\t\t\t\t} else if (f.status === 'D') {\n\t\t\t\t\t\t\tentry.stats.files.deleted++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tentry.stats.files.changed++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithFileSummary(): LogParserWithFileSummary<void>;\nfunction createLogParserWithFileSummary<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFileSummary<T>;\nfunction createLogParserWithFileSummary<T extends Record<string, string> | void>(\n\tmapping?: ExtractAll<T, string>,\n): LogParserWithFileSummary<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tif (mapping != null) {\n\t\tfor (const key in mapping) {\n\t\t\tkeys.push(key);\n\t\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t\t}\n\t}\n\tconst args = [`--format=${format}`, '--summary'];\n\n\tfunction parseFileSummary(content: string): LogParsedFile[] {\n\t\tconst files: LogParsedFile[] = [];\n\t\tif (!content?.length) return files;\n\n\t\tlet startIndex;\n\n\t\tlet path;\n\t\tlet originalPath;\n\t\tlet status;\n\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tif (!line) continue;\n\n\t\t\tif (line.startsWith(' rename ')) {\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(line.substring(8 /* move past ' rename ' */), true));\n\t\t\t\tfiles.push({ path: path, originalPath: originalPath, status: 'R' });\n\t\t\t} else if (line.startsWith(' copy ')) {\n\t\t\t\t({ path, originalPath } = parseCopyOrRename(line.substring(6 /* move past ' copy ' */), true));\n\t\t\t\tfiles.push({ path: path, originalPath: originalPath, status: 'C' });\n\t\t\t} else {\n\t\t\t\tif (line.startsWith(' create mode ')) {\n\t\t\t\t\tstatus = 'A';\n\t\t\t\t} else if (line.startsWith(' delete mode ')) {\n\t\t\t\t\tstatus = 'D';\n\t\t\t\t} else {\n\t\t\t\t\t// Ignore \" mode change \" lines\n\t\t\t\t\tif (!line.startsWith(' mode change ')) {\n\t\t\t\t\t\tdebugger;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstartIndex = line.indexOf(' ', 13 /* move past 'create mode <num>' or 'delete mode <num>' */);\n\t\t\t\tif (startIndex > -1) {\n\t\t\t\t\tpath = unquoteCString(line.substring(startIndex + 1));\n\t\t\t\t\tfiles.push({ path: path, status: status });\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithFileSummary.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet files: LogParsedFile[];\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfiles = [];\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commits and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tappendAll(files, parseFileSummary(summary));\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentry.files = files;\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t};\n}\n\n/**\n * Reads a numstat or summary name, or the two names of a rename or copy, trimmed as git wrote them: an unquoted name\n * is trimmed, while a quoted one keeps the whitespace inside its quotes\n */\nfunction parseCopyOrRename(field: string, stripPercentage: boolean): { path: string; originalPath?: string } {\n\tconst path = field.trim();\n\tif (path.includes('\"')) {\n\t\tconst quoted = parseQuotedRenameOrCopyPaths(path, stripPercentage);\n\t\tif (quoted != null) return quoted;\n\t}\n\n\tconst renameIndex = path.indexOf(' => ');\n\tif (renameIndex === -1) return { path: path };\n\n\tlet hasBraces = true;\n\n\tlet openIndex = path.indexOf('{');\n\tif (openIndex === -1) {\n\t\thasBraces = false;\n\t\topenIndex = 0;\n\t}\n\n\tlet closeIndex = path.indexOf('}', openIndex);\n\tif (closeIndex === -1) {\n\t\thasBraces = false;\n\t\tcloseIndex = path.length;\n\t}\n\n\tconst prefix = path.substring(0, openIndex);\n\tconst fromPart = path.substring(hasBraces ? openIndex + 1 : 0, renameIndex);\n\tlet toPart = path.substring(renameIndex + 4, closeIndex);\n\tlet suffix = path.substring(closeIndex + 1);\n\n\t// Check for percentage marker which always appears at the end as (xx%)\n\tif (stripPercentage) {\n\t\tif (hasBraces) {\n\t\t\tif (suffix.endsWith('%)')) {\n\t\t\t\t// Find the last open paren that starts the percentage\n\t\t\t\tconst percentPos = suffix.lastIndexOf(' (');\n\t\t\t\tif (percentPos > -1) {\n\t\t\t\t\tsuffix = suffix.substring(0, percentPos);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (toPart.endsWith('%)')) {\n\t\t\t// Find the last open paren that starts the percentage\n\t\t\tconst percentPos = toPart.lastIndexOf(' (');\n\t\t\tif (percentPos > -1) {\n\t\t\t\ttoPart = toPart.substring(0, percentPos);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tpath: normalizePath(joinPaths(prefix, toPart, suffix).trim()),\n\t\toriginalPath: normalizePath(joinPaths(prefix, fromPart, suffix).trim()),\n\t};\n}\n\nfunction createLogParserSingle(field: string): Parser<string> {\n\tconst args = ['-z', `--format=${field}`];\n\n\tfunction parse(data: string | Iterable<string> | undefined): Iterable<string> {\n\t\tusing _sw = maybeStopWatch('Git.LogParserSingle.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\treturn data ? iterateByDelimiter(data, '\\0') : [];\n\t}\n\n\treturn { arguments: args, separators: { record: '\\0', field: '\\0' }, parse: parse };\n}\n\nfunction createLogParserWithPatch<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFiles<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`];\n\n\tfunction parsePatch(content: string): LogParsedFile | undefined {\n\t\tconst lines = iterateByDelimiter(content, '\\n');\n\t\tlet line = lines.next();\n\t\tif (line.done) return undefined;\n\n\t\tif (!content.startsWith('diff --git ')) return undefined;\n\n\t\tconst paths = parseDiffFilePaths(content);\n\t\tif (paths == null) return undefined;\n\n\t\twhile (!line.done && !line.value.startsWith('@@ ')) {\n\t\t\tline = lines.next();\n\t\t}\n\n\t\tconst rangeMatch = line.value.match(diffHunkRegex);\n\n\t\tlet range: LogParsedRange | undefined;\n\t\tlet originalRange: LogParsedRange | undefined;\n\t\tif (rangeMatch != null) {\n\t\t\tlet start = parseInt(rangeMatch[1], 10);\n\t\t\tlet count = rangeMatch[2] ? parseInt(rangeMatch[2], 10) : 1;\n\n\t\t\toriginalRange = start && count ? { startLine: start, endLine: start + count - 1 } : undefined;\n\n\t\t\tstart = parseInt(rangeMatch[3], 10);\n\t\t\tcount = rangeMatch[4] ? parseInt(rangeMatch[4], 10) : 1;\n\n\t\t\trange = start && count ? { startLine: start, endLine: start + count - 1 } : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tstatus: 'M' satisfies GitFileIndexStatus,\n\t\t\tpath: paths.path,\n\t\t\toriginalPath: undefined,\n\t\t\trange: range,\n\t\t\toriginalRange: originalRange,\n\t\t};\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithPatch.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and patch, if any\n\t\t\t\t\tconst patch = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tconst file = parsePatch(patch);\n\t\t\t\t\tentry.files = file != null ? [file] : [];\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithPatch.parseAsync', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\t\t\t// Drop a truncated tail (cancelled/early-closed stream) instead of yielding undefined/partial fields.\n\t\t\tif (!isCompleteRecord(record, keys.length)) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and patch, if any\n\t\t\t\t\tconst patch = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tconst file = parsePatch(patch);\n\t\t\t\t\tentry.files = file != null ? [file] : [];\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithStats<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithStats<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`, '--shortstat'];\n\n\tfunction parseStats(content: string): LogParsedStats {\n\t\tconst stats: LogParsedStats = { files: 0, additions: 0, deletions: 0 };\n\t\tcontent = content?.trim();\n\t\tif (!content?.length) return { files: 0, additions: 0, deletions: 0 };\n\n\t\tlet filesEnd;\n\t\tlet filesIndex = content.indexOf(' files changed');\n\t\tif (filesIndex === -1) {\n\t\t\tfilesIndex = content.indexOf(' file changed');\n\t\t\tif (filesIndex === -1) return stats;\n\n\t\t\tfilesEnd = filesIndex + ' file changed'.length;\n\t\t} else {\n\t\t\tfilesEnd = filesIndex + ' files changed'.length;\n\t\t}\n\n\t\t// Extract number before \" files changed\"\n\t\tconst filesPart = content.substring(0, filesIndex).trim();\n\t\tstats.files = parseInt(filesPart, 10) || 0;\n\n\t\t// Extract additions if present\n\t\tconst additionsIndex = content.indexOf(' insertion', filesEnd);\n\t\tif (additionsIndex !== -1) {\n\t\t\t// Look for the number before \"insertion(+)\" or \"insertions(+)\"\n\t\t\tconst spaceIndex = content.lastIndexOf(' ', additionsIndex - 1);\n\t\t\tif (spaceIndex !== -1) {\n\t\t\t\tconst additionsPart = content.substring(spaceIndex, additionsIndex).trim();\n\t\t\t\tstats.additions = parseInt(additionsPart, 10) || 0;\n\t\t\t}\n\t\t}\n\n\t\t// Extract deletions if present\n\t\tconst deletionsIndex = content.indexOf(' deletion', filesEnd);\n\t\tif (deletionsIndex !== -1) {\n\t\t\t// Look for the number before \"\"deletion(-)\" or \"deletions(-)\"\n\t\t\tconst spaceIndex = content.lastIndexOf(' ', deletionsIndex - 1);\n\t\t\tif (spaceIndex !== -1) {\n\t\t\t\tconst deletionsPart = content.substring(spaceIndex, deletionsIndex).trim();\n\t\t\t\tstats.deletions = parseInt(deletionsPart, 10) || 0;\n\t\t\t}\n\t\t}\n\n\t\treturn stats;\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithStats<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithStats.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithStats<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithStats<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithStats<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tentry.stats = parseStats(summary);\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntryWithStats<T>> {\n\t\tusing sw = maybeStopWatch('Git.LogParserWithStats.parseAsync', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithStats<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithStats<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithStats<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and files/summary, if any\n\t\t\t\t\tconst summary = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tentry.stats = parseStats(summary);\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n\nfunction createLogParserWithFiles<T extends Record<string, string>>(\n\tmapping: ExtractAll<T, string>,\n): LogParserWithFiles<T> {\n\tlet format = recordFormatSep;\n\tconst keys: (keyof ExtractAll<T, string>)[] = [];\n\tfor (const key in mapping) {\n\t\tkeys.push(key);\n\t\tformat += `${mapping[key]}${fieldFormatSep}`;\n\t}\n\n\tconst args = [`--format=${format}`, '--name-only'];\n\n\tfunction parseFileNames(content: string): LogParsedFile[] {\n\t\tconst files: LogParsedFile[] = [];\n\t\tif (!content?.length) return files;\n\n\t\tfor (const line of iterateByDelimiter(content, '\\n')) {\n\t\t\tconst trimmed = line.trim();\n\t\t\tif (!trimmed) continue;\n\n\t\t\tfiles.push({ path: unquoteCString(trimmed) });\n\t\t}\n\n\t\treturn files;\n\t}\n\n\tfunction* parse(data: string | Iterable<string> | undefined): Generator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.createLogParserWithFiles.parse', { log: { onlyExit: true, level: 'debug' } });\n\n\t\tif (!data) {\n\t\t\tsw?.stop({ suffix: ` no data` });\n\t\t\treturn;\n\t\t}\n\n\t\tconst records = iterateByDelimiter(data, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and files, if any\n\t\t\t\t\tconst files = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tentry.files = parseFileNames(files);\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\tasync function* parseAsync(stream: AsyncGenerator<string>): AsyncGenerator<LogParsedEntryWithFiles<T>> {\n\t\tusing sw = maybeStopWatch('Git.createLogParserWithFiles.parseAsync', {\n\t\t\tlog: { onlyExit: true, level: 'debug' },\n\t\t});\n\n\t\tconst records = iterateAsyncByDelimiter(stream, recordSep);\n\n\t\tlet count = 0;\n\t\tlet entry: LogParsedEntryWithFiles<T>;\n\t\tlet fields: IterableIterator<string>;\n\n\t\tfor await (const record of records) {\n\t\t\tif (!record.length) continue;\n\n\t\t\tcount++;\n\t\t\tentry = {} as unknown as LogParsedEntryWithFiles<T>;\n\t\t\tfields = iterateByDelimiter(record, fieldSep);\n\n\t\t\tlet fieldCount = 0;\n\t\t\tlet field;\n\t\t\twhile (true) {\n\t\t\t\tfield = fields.next();\n\t\t\t\tif (field.done) break;\n\n\t\t\t\tif (fieldCount < keys.length) {\n\t\t\t\t\tentry[keys[fieldCount++]] = field.value as LogParsedEntryWithFiles<T>[keyof T];\n\t\t\t\t} else if (fieldCount === keys.length) {\n\t\t\t\t\t// Slice off the first newlines between the commit data and files, if any\n\t\t\t\t\tconst files = field.value.startsWith('\\n\\n')\n\t\t\t\t\t\t? field.value.substring(2)\n\t\t\t\t\t\t: field.value.startsWith('\\n')\n\t\t\t\t\t\t\t? field.value.substring(1)\n\t\t\t\t\t\t\t: field.value;\n\t\t\t\t\tentry.files = parseFileNames(files);\n\t\t\t\t} else {\n\t\t\t\t\tdebugger;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield entry;\n\t\t}\n\n\t\tsw?.stop({ suffix: ` parsed ${count} records` });\n\t}\n\n\treturn {\n\t\targuments: args,\n\t\tseparators: { record: recordSep, field: fieldSep },\n\t\tparse: parse,\n\t\tparseAsync: parseAsync,\n\t};\n}\n"],"mappings":";;;;;;AAOA,MAAM,iBAAiB;CACtB,KAAK;CACL,QAAQ;CACR,aAAa;CACb,YAAY;CACZ,WAAW;CACX,gBAAgB;CAChB,eAAe;CACf,SAAS;CACT,MAAM;CACN,SAAS;AACV;AAGA,IAAI;AAEJ,IAAI;AAEJ,IAAI;AAOJ,SAAgB,oBACf,cACA,aAC6E;CAC7E,IAAI,aAAa;EAChB,8BAA8B,yBAAyB,cAAc;EACrE,OAAO;CACR;CAEA,IAAI,cAAc;EACjB,4BAA4B,iCAAiC,cAAc;EAC3E,OAAO;CACR;CAEA,mBAAmB,gBAAgB,cAAc;CACjD,OAAO;AACR;AAEA,MAAM,sBAAsB;CAAE,KAAK;CAAM,QAAQ;CAAO,OAAO;CAAO,MAAM;CAAO,SAAS;AAAK;AAGjG,IAAI;AAEJ,IAAI;AAEJ,SAAgB,yBAAyB,OAAyE;CACjH,IAAI,OAAO;EACV,iCAAiC,yBAAyB,mBAAmB;EAC7E,OAAO;CACR;CAEA,wBAAwB,gBAAgB,mBAAmB;CAC3D,OAAO;AACR;AAEA,MAAM,eAAe;CACpB,KAAK;CACL,QAAQ;CACR,aAAa;CACb,YAAY;CACZ,eAAe;CACf,SAAS;CACT,MAAM;CACN,SAAS;AACV;AAGA,IAAI;AAEJ,IAAI;;;;;AAMJ,SAAgB,eAAe,OAA2D;CACzF,IAAI,OAAO;EACV,IAAI,yBAAyB,MAA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