@@ -19,37 +19,38 @@ type gitService struct {
19
19
20
20
func (s * gitService ) CreateBranch (ctx context.Context , repo string , params * scm.ReferenceInput ) (* scm.Response , error ) {
21
21
harnessURI := buildHarnessURI (s .client .account , s .client .organization , s .client .project , repo )
22
- repoId , queryParams , err := getRepoAndQueryParams (harnessURI )
22
+ repoID , queryParams , err := getRepoAndQueryParams (harnessURI )
23
23
if err != nil {
24
24
return nil , err
25
25
}
26
- path := fmt .Sprintf ("api/v1/repos/%s/branches?%s" , repoId , queryParams )
26
+ path := fmt .Sprintf ("api/v1/repos/%s/branches?%s" , repoID , queryParams )
27
27
in := & branchInput {
28
- Name : params .Name ,
29
- Target : params .Sha ,
28
+ Name : params .Name ,
29
+ Target : params .Sha ,
30
+ BypassRules : true ,
30
31
}
31
32
return s .client .do (ctx , "POST" , path , in , nil )
32
33
}
33
34
34
35
func (s * gitService ) FindBranch (ctx context.Context , repo , name string ) (* scm.Reference , * scm.Response , error ) {
35
36
harnessURI := buildHarnessURI (s .client .account , s .client .organization , s .client .project , repo )
36
- repoId , queryParams , err := getRepoAndQueryParams (harnessURI )
37
+ repoID , queryParams , err := getRepoAndQueryParams (harnessURI )
37
38
if err != nil {
38
39
return nil , nil , err
39
40
}
40
- path := fmt .Sprintf ("api/v1/repos/%s/branches/%s?%s" , repoId , name , queryParams )
41
+ path := fmt .Sprintf ("api/v1/repos/%s/branches/%s?%s" , repoID , name , queryParams )
41
42
out := new (branch )
42
43
res , err := s .client .do (ctx , "GET" , path , nil , out )
43
44
return convertBranch (out ), res , err
44
45
}
45
46
46
47
func (s * gitService ) FindCommit (ctx context.Context , repo , ref string ) (* scm.Commit , * scm.Response , error ) {
47
48
harnessURI := buildHarnessURI (s .client .account , s .client .organization , s .client .project , repo )
48
- repoId , queryParams , err := getRepoAndQueryParams (harnessURI )
49
+ repoID , queryParams , err := getRepoAndQueryParams (harnessURI )
49
50
if err != nil {
50
51
return nil , nil , err
51
52
}
52
- path := fmt .Sprintf ("api/v1/repos/%s/commits/%s?%s" , repoId , ref , queryParams )
53
+ path := fmt .Sprintf ("api/v1/repos/%s/commits/%s?%s" , repoID , ref , queryParams )
53
54
out := new (commitInfo )
54
55
res , err := s .client .do (ctx , "GET" , path , nil , out )
55
56
return convertCommitInfo (out ), res , err
@@ -61,11 +62,11 @@ func (s *gitService) FindTag(ctx context.Context, repo, name string) (*scm.Refer
61
62
62
63
func (s * gitService ) ListBranches (ctx context.Context , repo string , opts scm.ListOptions ) ([]* scm.Reference , * scm.Response , error ) {
63
64
harnessURI := buildHarnessURI (s .client .account , s .client .organization , s .client .project , repo )
64
- repoId , queryParams , err := getRepoAndQueryParams (harnessURI )
65
+ repoID , queryParams , err := getRepoAndQueryParams (harnessURI )
65
66
if err != nil {
66
67
return nil , nil , err
67
68
}
68
- path := fmt .Sprintf ("api/v1/repos/%s/branches?%s&%s" , repoId , encodeListOptions (opts ), queryParams )
69
+ path := fmt .Sprintf ("api/v1/repos/%s/branches?%s&%s" , repoID , encodeListOptions (opts ), queryParams )
69
70
out := []* branch {}
70
71
res , err := s .client .do (ctx , "GET" , path , nil , & out )
71
72
return convertBranchList (out ), res , err
@@ -79,47 +80,47 @@ func (s *gitService) ListBranchesV2(ctx context.Context, repo string, opts scm.B
79
80
80
81
func (s * gitService ) ListCommits (ctx context.Context , repo string , opts scm.CommitListOptions ) ([]* scm.Commit , * scm.Response , error ) {
81
82
harnessURI := buildHarnessURI (s .client .account , s .client .organization , s .client .project , repo )
82
- repoId , queryParams , err := getRepoAndQueryParams (harnessURI )
83
+ repoID , queryParams , err := getRepoAndQueryParams (harnessURI )
83
84
if err != nil {
84
85
return nil , nil , err
85
86
}
86
- path := fmt .Sprintf ("api/v1/repos/%s/commits?%s&%s" , repoId , encodeCommitListOptions (opts ), queryParams )
87
+ path := fmt .Sprintf ("api/v1/repos/%s/commits?%s&%s" , repoID , encodeCommitListOptions (opts ), queryParams )
87
88
out := new (commits )
88
89
res , err := s .client .do (ctx , "GET" , path , nil , & out )
89
90
return convertCommitList (out ), res , err
90
91
}
91
92
92
93
func (s * gitService ) ListTags (ctx context.Context , repo string , opts scm.ListOptions ) ([]* scm.Reference , * scm.Response , error ) {
93
94
harnessURI := buildHarnessURI (s .client .account , s .client .organization , s .client .project , repo )
94
- repoId , queryParams , err := getRepoAndQueryParams (harnessURI )
95
+ repoID , queryParams , err := getRepoAndQueryParams (harnessURI )
95
96
if err != nil {
96
97
return nil , nil , err
97
98
}
98
- path := fmt .Sprintf ("api/v1/repos/%s/tags?%s&%s" , repoId , encodeListOptions (opts ), queryParams )
99
+ path := fmt .Sprintf ("api/v1/repos/%s/tags?%s&%s" , repoID , encodeListOptions (opts ), queryParams )
99
100
out := []* branch {}
100
101
res , err := s .client .do (ctx , "GET" , path , nil , & out )
101
102
return convertBranchList (out ), res , err
102
103
}
103
104
104
105
func (s * gitService ) ListChanges (ctx context.Context , repo , ref string , opts scm.ListOptions ) ([]* scm.Change , * scm.Response , error ) {
105
106
harnessURI := buildHarnessURI (s .client .account , s .client .organization , s .client .project , repo )
106
- repoId , queryParams , err := getRepoAndQueryParams (harnessURI )
107
+ repoID , queryParams , err := getRepoAndQueryParams (harnessURI )
107
108
if err != nil {
108
109
return nil , nil , err
109
110
}
110
- path := fmt .Sprintf ("api/v1/repos/%s/commits/%s/diff?%s&%s" , repoId , ref , encodeListOptions (opts ), queryParams )
111
+ path := fmt .Sprintf ("api/v1/repos/%s/commits/%s/diff?%s&%s" , repoID , ref , encodeListOptions (opts ), queryParams )
111
112
out := []* fileDiff {}
112
113
res , err := s .client .do (ctx , "POST" , path , nil , & out )
113
114
return convertFileDiffs (out ), res , err
114
115
}
115
116
116
117
func (s * gitService ) CompareChanges (ctx context.Context , repo , source , target string , _ scm.ListOptions ) ([]* scm.Change , * scm.Response , error ) {
117
118
harnessURI := buildHarnessURI (s .client .account , s .client .organization , s .client .project , repo )
118
- repoId , queryParams , err := getRepoAndQueryParams (harnessURI )
119
+ repoID , queryParams , err := getRepoAndQueryParams (harnessURI )
119
120
if err != nil {
120
121
return nil , nil , err
121
122
}
122
- path := fmt .Sprintf ("api/v1/repos/%s/diff/%s...%s?%s" , repoId , source , target , queryParams )
123
+ path := fmt .Sprintf ("api/v1/repos/%s/diff/%s...%s?%s" , repoID , source , target , queryParams )
123
124
out := []* fileDiff {}
124
125
res , err := s .client .do (ctx , "GET" , path , nil , & out )
125
126
return convertChangeList (out ), res , err
@@ -151,8 +152,9 @@ type (
151
152
Title string `json:"title"`
152
153
}
153
154
branchInput struct {
154
- Name string `json:"name"`
155
- Target string `json:"target"`
155
+ Name string `json:"name"`
156
+ Target string `json:"target"`
157
+ BypassRules bool `json:"bypass_rules"`
156
158
}
157
159
branch struct {
158
160
Commit struct {
0 commit comments