Commit a1d1890e authored by Sander van Harmelen's avatar Sander van Harmelen

Fixup the GPG signature changes

parent 6cdaa84f
......@@ -17,7 +17,6 @@
package gitlab
import (
"database/sql"
"fmt"
"time"
)
......@@ -146,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
......@@ -158,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
......@@ -219,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
......@@ -452,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
......@@ -508,7 +507,7 @@ 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
......@@ -539,7 +538,7 @@ func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCo
return nil, nil, err
}
var c *Commit
c := new(Commit)
resp, err := s.client.Do(req, &c)
if err != nil {
return nil, resp, err
......@@ -548,23 +547,17 @@ func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCo
return c, resp, err
}
// GPGSubKey represents a GPG subkey ID.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#get-gpg-signature-of-a-commit
type GPGSubKey struct {
sql.NullInt64
}
// 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
// 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 *GPGSubKey `json:"gpg_key_subkey_id"`
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.
......@@ -584,7 +577,6 @@ func (s *CommitsService) GetGPGSiganature(pid interface{}, sha string, options .
sig := new(GPGSignature)
resp, err := s.client.Do(req, &sig)
if err != nil {
return nil, resp, err
}
......
......@@ -195,7 +195,7 @@ func TestGetGPGSignature(t *testing.T) {
KeyUserName: "Dmitriy Zaporozhets",
KeyUserEmail: "dmitriy.zaporozhets@gmail.com",
VerificationStatus: "verified",
KeySubkeyID: nil,
KeySubkeyID: 0,
}
assert.Equal(t, want, sig)
......
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
"short_id": "6104942438c",
"title": "Sanitize for network graph",
"author_name": "randx",
"author_email": "dmitriy.zaporozhets@gmail.com",
"committer_name": "Dmitriy",
"committer_email": "dmitriy.zaporozhets@gmail.com",
"message": "Sanitize for network graph",
"parent_ids": [
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"last_pipeline" : {
"id": 8,
"ref": "master",
"sha": "2dc6aa325a317eda67812f05600bdf0fcdc70ab0",
"status": "created",
"web_url":"https://gitlab.com/gitlab-org/gitlab-ce/pipelines/54268416"
},
"stats": {
"additions": 15,
"deletions": 10,
"total": 25
},
"status": "running",
"project_id":13083
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
"short_id": "6104942438c",
"title": "Sanitize for network graph",
"author_name": "randx",
"author_email": "dmitriy.zaporozhets@gmail.com",
"committer_name": "Dmitriy",
"committer_email": "dmitriy.zaporozhets@gmail.com",
"message": "Sanitize for network graph",
"parent_ids": [
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"last_pipeline": {
"id": 8,
"ref": "master",
"sha": "2dc6aa325a317eda67812f05600bdf0fcdc70ab0",
"status": "created",
"web_url": "https://gitlab.com/gitlab-org/gitlab-ce/pipelines/54268416"
},
"stats": {
"additions": 15,
"deletions": 10,
"total": 25
},
"status": "running",
"project_id": 13083
}
......@@ -5,4 +5,4 @@
"gpg_key_user_email": "dmitriy.zaporozhets@gmail.com",
"verification_status": "verified",
"gpg_key_subkey_id": null
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment