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

Error when trying to reply to a comment in an outdated file #12658

Closed
2 of 7 tasks
davidglezz opened this issue Aug 31, 2020 · 3 comments · Fixed by #13041
Closed
2 of 7 tasks

Error when trying to reply to a comment in an outdated file #12658

davidglezz opened this issue Aug 31, 2020 · 3 comments · Fixed by #13041

Comments

@davidglezz
Copy link

davidglezz commented Aug 31, 2020

  • Gitea version (or commit ref): 1.12.3
  • Git version:
  • Operating system: Ubuntu
  • Database (use [x]):
    • PostgreSQL
    • MSSQL
    • MySQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

During a review: when trying to reply to a comment in an outdated file, a 500 error occurs.

The file originally had many lines, ex 100
A comment is made on a line, ex 90
The file is modified so that it has less than 90 lines, example 50
When trying to reply to the comment the following error occurs:

2020/08/31 10:07:45 .../repo/pull_review.go:50:CreateCodeComment() [E] CreateCodeComment: LineBlame[refs/pull/23/head, /data/git/repositories/xxxx/test.git, views/js/test.js, 98]: exit status 128 - fatal: file views/js/test.js has only 50 lines

Screenshots

Error 500 page

@lhinderberger
Copy link

I can confirm - this bug happened to me as well.

Reproduction on try.gitea.io: https://try.gitea.io/knut/issue-12658/pulls/1
When trying to comment the outdated review comment, Gitea returns Error 500.

Parallel discussion: https://codeberg.org/Codeberg/Community/issues/299

@zeripath
Copy link
Contributor

zeripath commented Oct 5, 2020

} else if !strings.Contains(err.Error(), "exit status 128 - fatal: no such path") {

Needs to do the same check I added in #11882:

var notEnoughLines = regexp.MustCompile(`fatal: file .* has only \d+ lines?`)

if err != nil && (strings.Contains(err.Error(), "fatal: no such path") || notEnoughLines.MatchString(err.Error())) {

This is therefore likely a 2 line PR to fix.

@6543
Copy link
Member

6543 commented Oct 5, 2020

@zeripath 4Lines ;) - thx for the hint

and yes this was it -> #13041

(tested localy)

@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
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants