Browse Source

Fix when a commit not found returned 500 (#14732)

Co-authored-by: Lauris BH <lauris@nix.lv>
tags/v1.15.0-dev
Lunny Xiao GitHub 4 years ago
parent
commit
2a0f3b0fad
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      modules/git/repo_commit_nogogit.go

+ 6
- 0
modules/git/repo_commit_nogogit.go View File

@@ -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…
Cancel
Save