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/commit.go +6−3

@@ -116,9 +116,12 @@ func commitDiff(g *git.Repo, sha, selected string, files []diffFile, chosen int)
116 116 return main, nil
117 117 }
118 118 f := files[chosen]
119 patch, err := g.ShowPatchPath(sha, f.pathspec())
120 if err != nil {
121 return main, err
119 patch := ""
120 if len(f.pathspec()) > 0 {
121 var err error
122 if patch, err = g.ShowPatchPath(sha, f.pathspec()); err != nil {
123 return main, err
124 }
122 125 }
123 126 for _, p := range parseDiff(patch) {
124 127 if diffFilePath(p) == selected {