Skip to content

Commit

Permalink
fix: not showing empty context line below diff
Browse files Browse the repository at this point in the history
For diffs with context around hunks (eg. using git diff -U1),
if the context line below a diff was empty then the line was not
shown, this commit fixes it.
  • Loading branch information
PLukas2018 authored and otakustay committed Feb 18, 2024
1 parent abecfaa commit b531e13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function normalizeDiffText(text: string) {
}

export function parseDiff(text: string, options: ParseOptions = {}): File[] {
const diffText = normalizeDiffText(text.trim());
const diffText = normalizeDiffText(text.trimStart());
const files = parser.parse(diffText);

return files.map(file => mapFile(file, options));
Expand Down

0 comments on commit b531e13

Please sign in to comment.