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
cc7d6979
Commit
cc7d6979
authored
Jan 04, 2016
by
Martin Sefcik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed pointers
parent
261b930b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
27 deletions
+30
-27
commits.go
commits.go
+28
-25
commits_test.go
commits_test.go
+2
-2
No files found.
commits.go
View file @
cc7d6979
...
...
@@ -169,13 +169,13 @@ type CommitComment struct {
type
Author
struct
{
ID
*
int
`json:"id"`
Username
*
string
`json:"username"`
Email
*
string
`json:"email"`
Name
*
string
`json:"name"`
State
*
string
`json:"state"`
Blocked
*
bool
`json:"blocked"`
CreatedAt
*
time
.
Time
`json:"created_at"`
ID
int
`json:"id"`
Username
string
`json:"username"`
Email
string
`json:"email"`
Name
string
`json:"name"`
State
string
`json:"state"`
Blocked
bool
`json:"blocked"`
CreatedAt
time
.
Time
`json:"created_at"`
}
func
(
c
CommitComment
)
String
()
string
{
...
...
@@ -255,34 +255,36 @@ func (s *CommitsService) PostCommitComment(
//
// GitLab API docs: http://doc.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
type
GetCommitStatusesOptions
struct
{
Ref
string
`url:"ref,omitempty"`
Stage
string
`url:"stage,omitempty"`
Name
string
`url:"name,omitempty"`
All
bool
`url:"all,omitempty"`
Ref
string
`url:"ref,omitempty"
json:"ref,omitempty"
`
Stage
string
`url:"stage,omitempty"
json:"stage,omitempty"
`
Name
string
`url:"name,omitempty"
json:"name,omitempty"
`
All
bool
`url:"all,omitempty"
json:"all,omitempty"
`
}
// CommitStatus represents a GitLab commit status.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
type
CommitStatus
struct
{
ID
*
int
`json:"id"`
SHA
*
string
`json:"sha"`
Ref
*
string
`json:"ref"`
Status
*
string
`json:"status"`
Name
*
string
`json:"name"`
TargetUrl
*
string
`json:"target_url"`
Description
*
string
`json:"description"`
CreatedAt
*
time
.
Time
`json:"created_at"`
StartedAt
*
time
.
Time
`json:"started_at"`
FinishedAt
*
time
.
Time
`json:"finished_at"`
Author
*
Author
`json:"author"`
ID
int
`json:"id"`
SHA
string
`json:"sha"`
Ref
string
`json:"ref"`
Status
string
`json:"status"`
Name
string
`json:"name"`
TargetUrl
string
`json:"target_url"`
Description
string
`json:"description"`
CreatedAt
time
.
Time
`json:"created_at"`
StartedAt
time
.
Time
`json:"started_at"`
FinishedAt
time
.
Time
`json:"finished_at"`
Author
Author
`json:"author"`
}
// GetCommitStatuses gets the statuses of a commit in a project.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
func
(
s
*
CommitsService
)
GetCommitStatuses
(
pid
interface
{},
sha
string
,
opt
*
GetCommitStatusesOptions
)
([]
*
CommitStatus
,
*
Response
,
error
)
{
pid
interface
{},
sha
string
,
opt
*
GetCommitStatusesOptions
)
([]
*
CommitStatus
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -329,8 +331,9 @@ const (
//
// GitLab API docs: http://doc.gitlab.com/ce/api/commits.html#post-the-status-to-commit
func
(
s
*
CommitsService
)
SetCommitStatus
(
pid
interface
{},
sha
string
,
opt
*
SetCommitStatusOptions
)
(
*
CommitStatus
,
*
Response
,
error
)
{
pid
interface
{},
sha
string
,
opt
*
SetCommitStatusOptions
)
(
*
CommitStatus
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
commits_test.go
View file @
cc7d6979
...
...
@@ -29,7 +29,7 @@ func TestGetCommitStatuses(t *testing.T) {
t
.
Errorf
(
"Commits.GetCommitStatuses returned error: %v"
,
err
)
}
want
:=
[]
*
CommitStatus
{{
ID
:
Int
(
1
)
}}
want
:=
[]
*
CommitStatus
{{
ID
:
1
}}
if
!
reflect
.
DeepEqual
(
want
,
statuses
)
{
t
.
Errorf
(
"Commits.GetCommitStatuses returned %+v, want %+v"
,
statuses
,
want
)
}
...
...
@@ -58,7 +58,7 @@ func TestSetCommitStatus(t *testing.T) {
t
.
Errorf
(
"Commits.SetCommitStatus returned error: %v"
,
err
)
}
want
:=
&
CommitStatus
{
ID
:
Int
(
1
)
}
want
:=
&
CommitStatus
{
ID
:
1
}
if
!
reflect
.
DeepEqual
(
want
,
status
)
{
t
.
Errorf
(
"Commits.SetCommitStatus returned %+v, want %+v"
,
status
,
want
)
}
...
...
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