Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
a1d1890e
Commit
a1d1890e
authored
Jul 14, 2019
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixup the GPG signature changes
parent
6cdaa84f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
50 deletions
+41
-50
commits.go
commits.go
+14
-22
commits_test.go
commits_test.go
+1
-1
get_commit.json
testdata/get_commit.json
+25
-25
get_signature.json
testdata/get_signature.json
+1
-2
No files found.
commits.go
View file @
a1d1890e
...
...
@@ -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
}
...
...
commits_test.go
View file @
a1d1890e
...
...
@@ -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
)
...
...
testdata/get_commit.json
View file @
a1d1890e
{
"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
}
testdata/get_signature.json
View file @
a1d1890e
...
...
@@ -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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment