|
|
@ -126,15 +126,10 @@ func (repo *Repository) getCommit(id sha1) (*Commit, error) { |
|
|
|
|
|
|
|
|
|
|
|
// GetCommit returns commit object of by ID string.
|
|
|
|
// GetCommit returns commit object of by ID string.
|
|
|
|
func (repo *Repository) GetCommit(commitID string) (*Commit, error) { |
|
|
|
func (repo *Repository) GetCommit(commitID string) (*Commit, error) { |
|
|
|
if len(commitID) != 40 { |
|
|
|
|
|
|
|
var err error |
|
|
|
var err error |
|
|
|
commitID, err = NewCommand("rev-parse", commitID).RunInDir(repo.Path) |
|
|
|
commitID, err = GetFullCommitID(repo.Path, commitID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if strings.Contains(err.Error(), "exit status 128") { |
|
|
|
return nil, fmt.Errorf("GetCommitFullID: %v", err) |
|
|
|
return nil, ErrNotExist{commitID, ""} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nil, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
id, err := NewIDFromString(commitID) |
|
|
|
id, err := NewIDFromString(commitID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|