mirror of
https://github.com/gogs/gogs.git
synced 2025-12-21 15:50:00 +01:00
vendor: update github.com/gogs/git-module
This commit is contained in:
16
vendor/github.com/gogs/git-module/commit.go
generated
vendored
16
vendor/github.com/gogs/git-module/commit.go
generated
vendored
@@ -303,3 +303,19 @@ func GetCommitFileStatus(repoPath, commitID string) (*CommitFileStatus, error) {
|
||||
func (c *Commit) FileStatus() (*CommitFileStatus, error) {
|
||||
return GetCommitFileStatus(c.repo.Path, c.ID.String())
|
||||
}
|
||||
|
||||
// GetFullCommitID returns full length (40) of commit ID by given short SHA in a repository.
|
||||
func GetFullCommitID(repoPath, shortID string) (string, error) {
|
||||
if len(shortID) >= 40 {
|
||||
return shortID, nil
|
||||
}
|
||||
|
||||
commitID, err := NewCommand("rev-parse", shortID).RunInDir(repoPath)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "exit status 128") {
|
||||
return "", ErrNotExist{shortID, ""}
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSpace(commitID), nil
|
||||
}
|
||||
|
||||
2
vendor/github.com/gogs/git-module/git.go
generated
vendored
2
vendor/github.com/gogs/git-module/git.go
generated
vendored
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const _VERSION = "0.6.5"
|
||||
const _VERSION = "0.6.6"
|
||||
|
||||
func Version() string {
|
||||
return _VERSION
|
||||
|
||||
13
vendor/github.com/gogs/git-module/repo_commit.go
generated
vendored
13
vendor/github.com/gogs/git-module/repo_commit.go
generated
vendored
@@ -126,15 +126,10 @@ func (repo *Repository) getCommit(id sha1) (*Commit, error) {
|
||||
|
||||
// GetCommit returns commit object of by ID string.
|
||||
func (repo *Repository) GetCommit(commitID string) (*Commit, error) {
|
||||
if len(commitID) != 40 {
|
||||
var err error
|
||||
commitID, err = NewCommand("rev-parse", commitID).RunInDir(repo.Path)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "exit status 128") {
|
||||
return nil, ErrNotExist{commitID, ""}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
var err error
|
||||
commitID, err = GetFullCommitID(repo.Path, commitID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("GetCommitFullID: %v", err)
|
||||
}
|
||||
id, err := NewIDFromString(commitID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user