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
2dc14fdc
Unverified
Commit
2dc14fdc
authored
Oct 30, 2018
by
Sander van Harmelen
Committed by
GitHub
Oct 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MergeBase repo method. (#506)
Fixes #505
parent
eb6ccd3e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
repositories.go
repositories.go
+35
-2
No files found.
repositories.go
View file @
2dc14fdc
...
...
@@ -230,8 +230,7 @@ func (c Contributor) String() string {
return
Stringify
(
c
)
}
// ListContributorsOptions represents the available ListContributorsOptions()
// options.
// ListContributorsOptions represents the available ListContributors() options.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors
type
ListContributorsOptions
ListOptions
...
...
@@ -259,3 +258,37 @@ func (s *RepositoriesService) Contributors(pid interface{}, opt *ListContributor
return
c
,
resp
,
err
}
// MergeBaseOptions represents the available MergeBase() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/repositories.html#merge-base
type
MergeBaseOptions
struct
{
Ref
[]
string
`url:"refs[],omitempty" json:"refs,omitempty"`
}
// MergeBase gets the common ancestor for 2 refs (commit SHAs, branch
// names or tags).
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/repositories.html#merge-base
func
(
s
*
RepositoriesService
)
MergeBase
(
pid
interface
{},
opt
*
MergeBaseOptions
,
options
...
OptionFunc
)
(
*
Commit
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/merge_base"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
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
}
return
c
,
resp
,
err
}
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