diff options
Diffstat (limited to 'modules/git/repo_commit.go')
-rw-r--r-- | modules/git/repo_commit.go | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 5e2db34fd1..664a7445dd 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -24,27 +24,6 @@ func (repo *Repository) GetTagCommitID(name string) (string, error) { return repo.GetRefCommitID(TagPrefix + name) } -// ConvertToSHA1 returns a Hash object from a potential ID string -func (repo *Repository) ConvertToSHA1(commitID string) (SHA1, error) { - if len(commitID) == 40 { - sha1, err := NewIDFromString(commitID) - if err == nil { - return sha1, nil - } - } - - actualCommitID, err := NewCommand("rev-parse", "--verify", commitID).RunInDir(repo.Path) - if err != nil { - if strings.Contains(err.Error(), "unknown revision or path") || - strings.Contains(err.Error(), "fatal: Needed a single revision") { - return SHA1{}, ErrNotExist{commitID, ""} - } - return SHA1{}, err - } - - return NewIDFromString(actualCommitID) -} - // GetCommit returns commit object of by ID string. func (repo *Repository) GetCommit(commitID string) (*Commit, error) { id, err := repo.ConvertToSHA1(commitID) |