|
|
@ -12,9 +12,9 @@ import (
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/mcuadros/go-version"
|
|
|
|
|
|
|
|
"github.com/go-git/go-git/v5/plumbing"
|
|
|
|
"github.com/go-git/go-git/v5/plumbing"
|
|
|
|
"github.com/go-git/go-git/v5/plumbing/object"
|
|
|
|
"github.com/go-git/go-git/v5/plumbing/object"
|
|
|
|
|
|
|
|
"github.com/mcuadros/go-version"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// GetRefCommitID returns the last commit ID string of given reference (branch or tag).
|
|
|
|
// GetRefCommitID returns the last commit ID string of given reference (branch or tag).
|
|
|
@ -94,9 +94,15 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
|
|
|
|
gogitCommit, err := repo.gogitRepo.CommitObject(id)
|
|
|
|
gogitCommit, err := repo.gogitRepo.CommitObject(id)
|
|
|
|
if err == plumbing.ErrObjectNotFound {
|
|
|
|
if err == plumbing.ErrObjectNotFound {
|
|
|
|
tagObject, err = repo.gogitRepo.TagObject(id)
|
|
|
|
tagObject, err = repo.gogitRepo.TagObject(id)
|
|
|
|
|
|
|
|
if err == plumbing.ErrObjectNotFound {
|
|
|
|
|
|
|
|
return nil, ErrNotExist{
|
|
|
|
|
|
|
|
ID: id.String(),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if err == nil {
|
|
|
|
if err == nil {
|
|
|
|
gogitCommit, err = repo.gogitRepo.CommitObject(tagObject.Target)
|
|
|
|
gogitCommit, err = repo.gogitRepo.CommitObject(tagObject.Target)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we get a plumbing.ErrObjectNotFound here then the repository is broken and it should be 500
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|