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 breaks if csv deleted from base and head #22946

Closed
kdumontnu opened this issue Feb 17, 2023 · 3 comments · Fixed by #22949
Closed

Diff breaks if csv deleted from base and head #22946

kdumontnu opened this issue Feb 17, 2023 · 3 comments · Fixed by #22949
Labels
Milestone

Comments

@kdumontnu
Copy link
Contributor

Description

Deleting a .csv file from both the base and head branch in a compare will result in a 500 error.

https://try.gitea.io/kdumontnu/test/compare/main...delete-csv

Gitea Version

d9c6cb7

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Seen on 1.17 initially. Reproduced on try.gitea.

Database

None

@lunny lunny added this to the 1.18.4 milestone Feb 17, 2023
@lunny
Copy link
Member

lunny commented Feb 17, 2023

2023/02/17 02:58:03 ...s/context/context.go:231:HTML() [E] [63eeed3b-8] Render failed: template: repo/diff/csv_diff:3:15: executing "repo/diff/csv_diff" at <call .root.CreateCsvDiff .file .blobBase .blobHead>: error calling call: runtime error: invalid memory address or nil pointer dereference

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Feb 17, 2023

@wxiaoguang
Copy link
Contributor

OK, I fully understand the problem now. If a CSV file is deleted from both branch, then baseReader and headReader can both be nil.

@lunny lunny modified the milestones: 1.18.4, 1.18.5 Feb 19, 2023
lunny pushed a commit that referenced this issue Feb 20, 2023
Replaces: #22947
Fixes #22946
Probably related to #19530

Basically, many of the diffs were broken because they were comparing to
the base commit, where a 3-dot diff should be comparing to the [last
common
ancestor](https://matthew-brett.github.io/pydagogue/git_diff_dots.html).

This should have an integration test so that we don’t run into this
issue again.

---------

Co-authored-by: Jonathan Tran <[email protected]>
techknowlogick pushed a commit that referenced this issue Feb 21, 2023
Backport #22949
Fixes #22946
Probably related to #19530

Co-authored-by: Jonathan Tran <[email protected]>
Codeberg-org pushed a commit to Codeberg-org/gitea that referenced this issue Feb 23, 2023
Backport go-gitea#22949
Fixes go-gitea#22946
Probably related to go-gitea#19530

Co-authored-by: Jonathan Tran <[email protected]>
(cherry picked from commit 760cf41)
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants