Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff skips lines starting with '++ ' or '-- ' #13153

Closed
1 of 3 tasks
zeripath opened this issue Oct 15, 2020 · 0 comments · Fixed by #13154
Closed
1 of 3 tasks

Diff skips lines starting with '++ ' or '-- ' #13153

zeripath opened this issue Oct 15, 2020 · 0 comments · Fixed by #13154
Labels
Milestone

Comments

@zeripath
Copy link
Contributor

zeripath commented Oct 15, 2020

Description

First noted in https://codeberg.org/Codeberg/Community/issues/308

Gitea's ParsePatch code in services/gitdiff/gitdiff.go will skip any diff lines that start with "+++ " or "--- ".

zeripath added a commit to zeripath/gitea that referenced this issue Oct 15, 2020
ParsePatch previously just skipped all lines that start with "+++ " or "--- "
and makes no attempt to see these lines in context.

This PR rewrites ParsePatch to pay attention to context and position
within a patch, ensuring that --- and +++ are only skipped if
appropriate.

This PR also fixes several issues with incomplete files.

Fix https://codeberg.org/Codeberg/Community/issues/308
Fix go-gitea#13153

Signed-off-by: Andrew Thornton <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this issue Oct 15, 2020
Backport go-gitea#13154

ParsePatch previously just skipped all lines that start with "+++ " or "--- "
and makes no attempt to see these lines in context.

This PR rewrites ParsePatch to pay attention to context and position
within a patch, ensuring that --- and +++ are only skipped if
appropriate.

This PR also fixes several issues with incomplete files.

Fix https://codeberg.org/Codeberg/Community/issues/308
Fix go-gitea#13153

Signed-off-by: Andrew Thornton <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this issue Oct 15, 2020
Backport go-gitea#13154

ParsePatch previously just skipped all lines that start with "+++ " or "--- "
and makes no attempt to see these lines in context.

This PR rewrites ParsePatch to pay attention to context and position
within a patch, ensuring that --- and +++ are only skipped if
appropriate.

This PR also fixes several issues with incomplete files.

Fix https://codeberg.org/Codeberg/Community/issues/308
Fix go-gitea#13153

Signed-off-by: Andrew Thornton <[email protected]>
@lunny lunny added the type/bug label Oct 15, 2020
@lunny lunny added this to the 1.12.6 milestone Oct 15, 2020
techknowlogick pushed a commit that referenced this issue Oct 16, 2020
* Fix diff skipping lines

ParsePatch previously just skipped all lines that start with "+++ " or "--- "
and makes no attempt to see these lines in context.

This PR rewrites ParsePatch to pay attention to context and position
within a patch, ensuring that --- and +++ are only skipped if
appropriate.

This PR also fixes several issues with incomplete files.

Fix https://codeberg.org/Codeberg/Community/issues/308
Fix #13153

Signed-off-by: Andrew Thornton <[email protected]>

* Add testcase

Signed-off-by: Andrew Thornton <[email protected]>

* fix comment

* simplify error handling

Signed-off-by: Andrew Thornton <[email protected]>

* never return io.EOF

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
techknowlogick pushed a commit that referenced this issue Oct 16, 2020
* Fix diff skipping lines

Backport #13154

ParsePatch previously just skipped all lines that start with "+++ " or "--- "
and makes no attempt to see these lines in context.

This PR rewrites ParsePatch to pay attention to context and position
within a patch, ensuring that --- and +++ are only skipped if
appropriate.

This PR also fixes several issues with incomplete files.

Fix https://codeberg.org/Codeberg/Community/issues/308
Fix #13153

Signed-off-by: Andrew Thornton <[email protected]>

* Add testcase

Signed-off-by: Andrew Thornton <[email protected]>

* fix comment

* simplify error handling

Signed-off-by: Andrew Thornton <[email protected]>

* never return io.EOF

Signed-off-by: Andrew Thornton <[email protected]>
techknowlogick added a commit that referenced this issue Oct 17, 2020
* Fix diff skipping lines

Backport #13154

ParsePatch previously just skipped all lines that start with "+++ " or "--- "
and makes no attempt to see these lines in context.

This PR rewrites ParsePatch to pay attention to context and position
within a patch, ensuring that --- and +++ are only skipped if
appropriate.

This PR also fixes several issues with incomplete files.

Fix https://codeberg.org/Codeberg/Community/issues/308
Fix #13153

Signed-off-by: Andrew Thornton <[email protected]>

* Add testcase

Signed-off-by: Andrew Thornton <[email protected]>

* fix comment

* simplify error handling

Signed-off-by: Andrew Thornton <[email protected]>

* never return io.EOF

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants