Commit 26ea551e authored by JB Sazon's avatar JB Sazon Committed by Sander van Harmelen

Add merge method constants (#410)

parent 72694947
......@@ -213,6 +213,20 @@ const (
PublicVisibility VisibilityValue = "public"
)
// MergeMethodValue represents a project merge type within GitLab.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
type MergeMethodValue string
// List of available merge type
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
const (
NoFastForwardMerge MergeMethodValue = "merge"
FastForwardMerge MergeMethodValue = "ff"
RebaseMerge MergeMethodValue = "rebase_merge"
)
// EventTypeValue represents actions type for contribution events
type EventTypeValue string
......@@ -830,3 +844,11 @@ func Visibility(v VisibilityValue) *VisibilityValue {
*p = v
return p
}
// MergeMethod is a helper routine that allocates a new MergeMethod
// to sotre v and returns a pointer to it.
func MergeMethod(v MergeMethodValue) *MergeMethodValue {
p := new(MergeMethodValue)
*p = v
return p
}
......@@ -391,7 +391,7 @@ type CreateProjectOptions struct {
PublicJobs *bool `url:"public_jobs,omitempty" json:"public_jobs,omitempty"`
OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
MergeMethod *string `url:"merge_method,omitempty" json:"merge_method,omitempty"`
MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"`
LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
......
......@@ -234,7 +234,10 @@ func TestCreateProject(t *testing.T) {
fmt.Fprint(w, `{"id":1}`)
})
opt := &CreateProjectOptions{Name: String("n")}
opt := &CreateProjectOptions{
Name: String("n"),
MergeMethod: MergeMethod(RebaseMerge),
}
project, _, err := client.Projects.CreateProject(opt)
if err != nil {
......
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