-
Notifications
You must be signed in to change notification settings - Fork 5
Description
See parkerbxyz/suggest-changes#50 (comment)
The TLDR is that it seems like parse-git-diff can handle @@ -74,2 +74 @@, but for 1 line changes git will omit the ,1 and just report @@ -74 +74 @@ and that causes the regex handling in parse-git-diff to break.
I see the "normal" chunk regex here:
parse-git-diff/src/parse-git-diff.ts
Lines 223 to 224 in e8ed56d
| const normalChunkExec = | |
| /^@@\s\-(\d+),?(\d+)?\s\+(\d+),?(\d+)?\s@@\s?(.+)?/.exec(line); |
Which gets expanded out here:
parse-git-diff/src/parse-git-diff.ts
Lines 268 to 269 in e8ed56d
| const [all, delStart, delLines, addStart, addLines, context] = | |
| normalChunkExec; |
I'm no expert here but I think whats happening is that it has an optional capture group for the ,<digit> which should become delLines, but that's missing here so instead the next capture group actually gets put in as delLines, which happens to be addStart, which is 94, so it reports 94 lines in fromFileRange 😢