From 937bdbcac48430327692dbc62044811bdf06f9e7 Mon Sep 17 00:00:00 2001 From: rtritto Date: Sat, 23 May 2026 10:25:43 +0200 Subject: [PATCH] fix: allow parsing empty context lines at the very end of unified diffs --- src/patch/parse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/patch/parse.ts b/src/patch/parse.ts index d894f302..7e9105e2 100755 --- a/src/patch/parse.ts +++ b/src/patch/parse.ts @@ -467,7 +467,7 @@ export function parsePatch(uniDiff: string): StructuredPatch[] { i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || diffstr[i]?.startsWith('\\')); i++ ) { - const operation = (diffstr[i].length == 0 && i != (diffstr.length - 1)) ? ' ' : diffstr[i][0]; + const operation = diffstr[i].length == 0 ? ' ' : diffstr[i][0]; if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { hunk.lines.push(diffstr[i]);