You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cc @sofiia-tesliuk. I think @mrnugget will spend a little bit of time trying to fix this, but more than likely we will probably revert #53 and then re-introduce it once we can do it in a way that doesn't cause panics.
This fixes#54 by making the detection of non-extended file headers
(which start with `---` directly) that was introduced in #53 more
robust.
Instead of simply aborting when the current line starts with `---`
(which is a valid hunk line, if you, say, remove a line starting with
`--`), we confirm that the next line also starts with `+++` by peeking a
bit ahead.
That's also what `git` does: https://sourcegraph.com/github.com/git/git/-/blob/apply.c#L1574-1576
PR #53 introduced behaviour that tries to detect new file headers while parsing hunks.
The problem is that it breaks the parsing of diffs like these:
If we try to parse this we get a nil-panic:
The nil panic comes from a missing return here:
go-diff/diff/parse.go
Lines 60 to 64 in 96789e3
But the underlying cause is that we abort the parsing of the diff once we hit the
--
.The text was updated successfully, but these errors were encountered: