mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 01:05:14 +00:00
Fix when a commit not found returned 500 (#14732)
Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
8f05a2876b
commit
6362b24a59
|
@ -8,6 +8,7 @@ package git
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
@ -70,10 +71,15 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
|
|||
bufReader := bufio.NewReader(stdoutReader)
|
||||
_, typ, size, err := ReadBatchLine(bufReader)
|
||||
if err != nil {
|
||||
if errors.Is(err, io.EOF) {
|
||||
return nil, ErrNotExist{ID: id.String()}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch typ {
|
||||
case "missing":
|
||||
return nil, ErrNotExist{ID: id.String()}
|
||||
case "tag":
|
||||
// then we need to parse the tag
|
||||
// and load the commit
|
||||
|
|
Loading…
Reference in a new issue