aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/xanzy/go-gitlab/commits.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/commits.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/commits.go84
1 files changed, 76 insertions, 8 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/commits.go b/vendor/github.com/xanzy/go-gitlab/commits.go
index 7556394b..4bf067e8 100644
--- a/vendor/github.com/xanzy/go-gitlab/commits.go
+++ b/vendor/github.com/xanzy/go-gitlab/commits.go
@@ -145,7 +145,7 @@ type GetCommitRefsOptions struct {
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
-func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetCommitRefsOptions, options ...OptionFunc) ([]CommitRef, *Response, error) {
+func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetCommitRefsOptions, options ...OptionFunc) ([]*CommitRef, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
@@ -157,7 +157,7 @@ func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetComm
return nil, nil, err
}
- var cs []CommitRef
+ var cs []*CommitRef
resp, err := s.client.Do(req, &cs)
if err != nil {
return nil, resp, err
@@ -218,7 +218,7 @@ func (s *CommitsService) CreateCommit(pid interface{}, opt *CreateCommitOptions,
return nil, nil, err
}
- var c *Commit
+ c := new(Commit)
resp, err := s.client.Do(req, &c)
if err != nil {
return nil, resp, err
@@ -451,7 +451,7 @@ func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCo
return nil, nil, err
}
- var cs *CommitStatus
+ cs := new(CommitStatus)
resp, err := s.client.Do(req, &cs)
if err != nil {
return nil, resp, err
@@ -485,14 +485,14 @@ func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, o
return mrs, resp, err
}
-// CherryPickCommitOptions represents the available options for cherry-picking a commit.
+// CherryPickCommitOptions represents the available CherryPickCommit() options.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit
type CherryPickCommitOptions struct {
- TargetBranch *string `url:"branch" json:"branch,omitempty"`
+ Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
}
-// CherryPickCommit sherry picks a commit to a given branch.
+// CherryPickCommit cherry picks a commit to a given branch.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit
func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *CherryPickCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
@@ -507,7 +507,38 @@ func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *Cher
return nil, nil, err
}
- var c *Commit
+ c := new(Commit)
+ resp, err := s.client.Do(req, &c)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return c, resp, err
+}
+
+// RevertCommitOptions represents the available RevertCommit() options.
+//
+// GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#revert-a-commit
+type RevertCommitOptions struct {
+ Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
+}
+
+// RevertCommit reverts a commit in a given branch.
+//
+// GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#revert-a-commit
+func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
+ project, err := parseID(pid)
+ if err != nil {
+ return nil, nil, err
+ }
+ u := fmt.Sprintf("projects/%s/repository/commits/%s/revert", pathEscape(project), sha)
+
+ req, err := s.client.NewRequest("POST", u, opt, options)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ c := new(Commit)
resp, err := s.client.Do(req, &c)
if err != nil {
return nil, resp, err
@@ -515,3 +546,40 @@ func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *Cher
return c, resp, err
}
+
+// GPGSignature represents a Gitlab commit's GPG Signature.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ee/api/commits.html#get-gpg-signature-of-a-commit
+type GPGSignature struct {
+ KeyID int `json:"gpg_key_id"`
+ KeyPrimaryKeyID string `json:"gpg_key_primary_keyid"`
+ KeyUserName string `json:"gpg_key_user_name"`
+ KeyUserEmail string `json:"gpg_key_user_email"`
+ VerificationStatus string `json:"verification_status"`
+ KeySubkeyID int `json:"gpg_key_subkey_id"`
+}
+
+// GetGPGSiganature gets a GPG signature of a commit.
+//
+// GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#get-gpg-signature-of-a-commit
+func (s *CommitsService) GetGPGSiganature(pid interface{}, sha string, options ...OptionFunc) (*GPGSignature, *Response, error) {
+ project, err := parseID(pid)
+ if err != nil {
+ return nil, nil, err
+ }
+ u := fmt.Sprintf("projects/%s/repository/commits/%s/signature", pathEscape(project), sha)
+
+ req, err := s.client.NewRequest("GET", u, nil, options)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ sig := new(GPGSignature)
+ resp, err := s.client.Do(req, &sig)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return sig, resp, err
+}