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
e17593e7
Commit
e17593e7
authored
Aug 15, 2019
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly path escape branch and sha parts of the URL
parent
3def0345
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
16 deletions
+18
-16
.travis.yml
.travis.yml
+0
-1
commits.go
commits.go
+12
-11
protected_branches.go
protected_branches.go
+3
-2
repositories.go
repositories.go
+3
-2
No files found.
.travis.yml
View file @
e17593e7
language
:
go
go
:
-
1.9.x
-
1.10.x
-
1.11.x
-
1.12.x
...
...
commits.go
View file @
e17593e7
...
...
@@ -18,6 +18,7 @@ package gitlab
import
(
"fmt"
"net/url"
"time"
)
...
...
@@ -150,7 +151,7 @@ func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetComm
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/refs"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/refs"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -175,7 +176,7 @@ func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...Optio
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -260,7 +261,7 @@ func (s *CommitsService) GetCommitDiff(pid interface{}, sha string, opt *GetComm
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/diff"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/diff"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -317,7 +318,7 @@ func (s *CommitsService) GetCommitComments(pid interface{}, sha string, opt *Get
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/comments"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/comments"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -356,7 +357,7 @@ func (s *CommitsService) PostCommitComment(pid interface{}, sha string, opt *Pos
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/comments"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/comments"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -408,7 +409,7 @@ func (s *CommitsService) GetCommitStatuses(pid interface{}, sha string, opt *Get
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/statuses"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/statuses"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -444,7 +445,7 @@ func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCo
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/statuses/%s"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/statuses/%s"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -469,7 +470,7 @@ func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, o
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/merge_requests"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/merge_requests"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -500,7 +501,7 @@ func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *Cher
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/cherry_pick"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/cherry_pick"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -531,7 +532,7 @@ func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCo
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/revert"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/revert"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -568,7 +569,7 @@ func (s *CommitsService) GetGPGSiganature(pid interface{}, sha string, options .
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/signature"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/signature"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
protected_branches.go
View file @
e17593e7
...
...
@@ -18,6 +18,7 @@ package gitlab
import
(
"fmt"
"net/url"
)
// ProtectedBranchesService handles communication with the protected branch
...
...
@@ -90,7 +91,7 @@ func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch st
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/protected_branches/%s"
,
pathEscape
(
project
),
branch
)
u
:=
fmt
.
Sprintf
(
"projects/%s/protected_branches/%s"
,
pathEscape
(
project
),
url
.
PathEscape
(
branch
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -153,7 +154,7 @@ func (s *ProtectedBranchesService) UnprotectRepositoryBranches(pid interface{},
if
err
!=
nil
{
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/protected_branches/%s"
,
pathEscape
(
project
),
branch
)
u
:=
fmt
.
Sprintf
(
"projects/%s/protected_branches/%s"
,
pathEscape
(
project
),
url
.
PathEscape
(
branch
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
repositories.go
View file @
e17593e7
...
...
@@ -20,6 +20,7 @@ import (
"bytes"
"fmt"
"io"
"net/url"
)
// RepositoriesService handles communication with the repositories related
...
...
@@ -91,7 +92,7 @@ func (s *RepositoriesService) Blob(pid interface{}, sha string, options ...Optio
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/blobs/%s"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/blobs/%s"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -116,7 +117,7 @@ func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, option
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/blobs/%s/raw"
,
pathEscape
(
project
),
sha
)
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/blobs/%s/raw"
,
pathEscape
(
project
),
url
.
PathEscape
(
sha
)
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
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