Closed
Description
I encountered this issue via aspect-build/rules_lint#487
tl;dr; If a file is missing a newline at the end or the patch removes the newline at the end, go-gitdiff fails applying the patch with the error:
conflict: fragment line does not match src line
I'll push a reproduction example through a failed test, where git
succeeds.
> git apply gitdiff/testdata/apply/file_text_modify.patch
> echo $?
0
> go test ./...
--- FAIL: TestApplyFile (0.00s)
--- FAIL: TestApplyFile/textModify (0.00s)
apply_test.go:190: unexpected error applying: at 4: fragment 1 at 5: conflict: fragment line does not match src line
FAIL
FAIL github.com/bluekeyes/go-gitdiff/gitdiff 0.321s
FAIL
The offending check can be found
go-gitdiff/gitdiff/apply_text.go
Line 128 in fffa3cc
Metadata
Metadata
Assignees
Labels
No labels