]> source.dussan.org Git - gitea.git/commit
Fix a couple of CommentAsPatch issues. (#14804)
authorzeripath <art27@cantab.net>
Sat, 27 Feb 2021 18:46:14 +0000 (18:46 +0000)
committerGitHub <noreply@github.com>
Sat, 27 Feb 2021 18:46:14 +0000 (19:46 +0100)
commit3d8b5ad5f37f495e50d83bbad214f8061f8a5ac4
treec4fb9d7b195f9a7af5d2e3fc275fa74accf0d01c
parent904a26c57c474e0ed7b43dc37269f69b49240301
Fix a couple of CommentAsPatch issues.  (#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

Signed-off-by: Andrew Thornton <art27@cantab.net>
* 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

Signed-off-by: Andrew Thornton <art27@cantab.net>
* 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>
modules/git/diff.go
modules/git/diff_test.go
modules/migrations/gitea_uploader.go
services/gitdiff/gitdiff.go
services/gitdiff/gitdiff_test.go
services/pull/review.go