Add single commit API support (#5843)

* add single commit API support
This commit is contained in:
Lunny Xiao 2019-02-03 11:35:17 +08:00 committed by techknowlogick
parent 3d91bb2f2d
commit ecefa9e724
10 changed files with 389 additions and 11 deletions

View file

@ -140,6 +140,9 @@ func (repo *Repository) GetCommit(commitID string) (*Commit, error) {
var err error
commitID, err = NewCommand("rev-parse", commitID).RunInDir(repo.Path)
if err != nil {
if strings.Contains(err.Error(), "unknown revision or path") {
return nil, ErrNotExist{commitID, ""}
}
return nil, err
}
}