1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-07 10:44:26 +00:00
gitea/services/gitdiff
zeripath be25afc6de
Fix a couple of CommentAsPatch issues. (#14804) (#14820)
Backport #14804

* CutDiffAroundLine makes the incorrect assumption that `---` and `+++` always represent part of the header of a diff.

This PR adds a flag to its parsing to prevent this problem and adds a streaming parsing technique to CutDiffAroundLine using an io.pipe instead of just sending data to an unbounded buffer.

Fix #14711

* Handle unquoted comment patch files

When making comment patches unfortunately the patch does not always quote the filename
This makes the diff --git header ambiguous again.

This PR finally adds handling for ambiguity in to parse patch

Fix #14812

* Add in testing for no error

There is no way currently for CutDiffAroundLine in this test to cause an
error however, it should still be tested.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-02-28 15:19:51 +02:00
..
testdata/academic-module Fix panic when diff (#9187) 2019-11-28 17:05:57 +08:00
gitdiff_test.go Fix a couple of CommentAsPatch issues. (#14804) (#14820) 2021-02-28 15:19:51 +02:00
gitdiff.go Fix a couple of CommentAsPatch issues. (#14804) (#14820) 2021-02-28 15:19:51 +02:00
main_test.go Move git diff codes from models to services/gitdiff (#7889) 2019-09-05 22:20:09 -04:00