-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
pull requests: wrong line numbers in discussions #17875
Comments
So which line is the right one? |
Sorry, i've forget to add that information: If you look at the screen of the |
Possibly some corner case in CutDiffAroundLine (https://github.com/go-gitea/gitea/blob/main/modules/git/diff.go#L135)? /cc @zeripath |
There was a bug in CutDiffAroundLine whereby if a file without a terminal new line has a patch which appends lines to it and a comment is placed on one of those lines the comment diff will be a line out of place. This fixes CutDiffAroundLine to simply ignore the missing terminal newline - however, we should really improve this rendering to add a marker to say that there was a previously missing terminal newline. Fix go-gitea#17875 Signed-off-by: Andrew Thornton <art27@cantab.net>
…a#18029) Backport go-gitea#18029 There was a bug in CutDiffAroundLine whereby if a file without a terminal new line has a patch which appends lines to it and a comment is placed on one of those lines the comment diff will be a line out of place. This fixes CutDiffAroundLine to simply ignore the missing terminal newline - however, we should really improve this rendering to add a marker to say that there was a previously missing terminal newline. Fix go-gitea#17875 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent off-by-one error on comments on newly appended lines There was a bug in CutDiffAroundLine whereby if a file without a terminal new line has a patch which appends lines to it and a comment is placed on one of those lines the comment diff will be a line out of place. This fixes CutDiffAroundLine to simply ignore the missing terminal newline - however, we should really improve this rendering to add a marker to say that there was a previously missing terminal newline. Fix #17875 Signed-off-by: Andrew Thornton <art27@cantab.net>
…#18035) * Prevent off-by-one error on comments on newly appended lines (#18029) Backport #18029 There was a bug in CutDiffAroundLine whereby if a file without a terminal new line has a patch which appends lines to it and a comment is placed on one of those lines the comment diff will be a line out of place. This fixes CutDiffAroundLine to simply ignore the missing terminal newline - however, we should really improve this rendering to add a marker to say that there was a previously missing terminal newline. Fix #17875 Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
…a#18029) * Prevent off-by-one error on comments on newly appended lines There was a bug in CutDiffAroundLine whereby if a file without a terminal new line has a patch which appends lines to it and a comment is placed on one of those lines the comment diff will be a line out of place. This fixes CutDiffAroundLine to simply ignore the missing terminal newline - however, we should really improve this rendering to add a marker to say that there was a previously missing terminal newline. Fix go-gitea#17875 Signed-off-by: Andrew Thornton <art27@cantab.net>
Gitea Version
1.16.0+dev-630-g042cac5fe
Git Version
No response
Operating System
No response
How are you running Gitea?
tested on try.gitea.io with a migrated repo
Database
No response
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
demo: https://try.gitea.io/murks/Vereinsdokumente/pulls/7
I've created a comment for line 23 in a PR. While everything is fine in the "Files Changed" tab, the text block in the conversation view is off-by-one which brings the comments out of context.
Screenshots
Files Changed
tab:Conversation
tab with wrong text section:The text was updated successfully, but these errors were encountered: