From 2883376503c8e1633d4cfb273fef3c80f39e7760 Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Mon, 11 May 2020 19:03:14 +0000 Subject: [PATCH] Revert "API split for: to get single commit via SHA and Ref (#319)" (#324) Merge branch 'master' into revert-commit-api-split Revert "API split for: to get single commit via SHA and Ref (#319)" This reverts commit 36d296423059b97fe8b7a5e4a85642168841a4b8. Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/324 Reviewed-by: lafriks Reviewed-by: Andrew Thornton --- gitea/repo_commit.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/gitea/repo_commit.go b/gitea/repo_commit.go index dcbe2a9..82ef3fa 100644 --- a/gitea/repo_commit.go +++ b/gitea/repo_commit.go @@ -8,7 +8,6 @@ package gitea import ( "fmt" "net/url" - "regexp" "time" ) @@ -55,16 +54,10 @@ type CommitDateOptions struct { Committer time.Time `json:"committer"` } -// SHAPattern can be used to determine if a string is an valid sha -var SHAPattern = regexp.MustCompile(`^[0-9a-f]{4,40}$`) - // GetSingleCommit returns a single commit func (c *Client) GetSingleCommit(user, repo, commitID string) (*Commit, error) { commit := new(Commit) - if e := c.CheckServerVersionConstraint("<1.12.0"); e == nil || SHAPattern.MatchString(commitID) { - return commit, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/git/commits/%s", user, repo, commitID), nil, nil, &commit) - } - return commit, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/commits/%s", user, repo, commitID), nil, nil, &commit) + return commit, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/git/commits/%s", user, repo, commitID), nil, nil, &commit) } // ListCommitOptions list commit options