Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Open a deleted file instead of failing the page

bef0c093da662024c936eb2c230cf2a3521ecbb9 · Keenan Nemetz · 8d ago · parent f64c77e4

Open a deleted file instead of failing the page

A deletion has an old path and no new one, and pathspec returned both sides to
git. Git refuses an empty pathspec outright, so opening a deleted file on a
commit page answered 500 and the file could not be reviewed at all. The per-file
read this branch gives the Files tab would have extended that to every deleted
file in a change.

Return one path for a deletion, both only for a rename, and none when a row has
no paths at all. No paths means there is no patch to ask for, which is not the
same as every path: callers stop before asking git instead of printing the whole
commit into a single file's pane.

TestPathspecNamesTheSideThatExists pins the four shapes, and
TestCommitPageShowsADeletedFile is the page that used to 500. The request Files
test now carries a deletion too, and opens it.

server/web/diff.go +9−1

@@ -36,8 +36,16 @@ func (f diffFile) Label() string {
36 36 // pathspec is what git has to be told to print this file's patch. A rename needs
37 37 // both of its paths: filtered to the destination alone, git reports what is left
38 38 // as a new file and the rename is lost.
39 //
40 // A deletion has one path, on the old side, and must not hand git the empty new
41 // side: git refuses an empty pathspec outright, so asking for a deleted file used
42 // to fail the whole page. Nothing at all is the one answer a caller has to
43 // handle: it means there is no patch to ask for, not "every path".
39 44 func (f diffFile) pathspec() []string {
40 if f.OldPath != "" && f.OldPath != f.NewPath {
45 if f.OldPath == "" && f.NewPath == "" {
46 return nil
47 }
48 if f.OldPath != "" && f.NewPath != "" && f.OldPath != f.NewPath {
41 49 return []string{f.OldPath, f.NewPath}
42 50 }
43 51 if f.NewPath != "" {