Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

GetCommit() returns a ErrNotExist if short commit ID does not exists #113

Merged
merged 2 commits into from
Feb 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions repo_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,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
}
}
Expand Down