Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5b0f3acd
Commit
5b0f3acd
authored
Sep 20, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass GL_USERNAME from GitLab to Gitaly
parent
11677f52
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
6 deletions
+11
-6
gitaly_test.go
gitaly_test.go
+4
-2
internal/git/receive-pack.go
internal/git/receive-pack.go
+1
-1
internal/gitaly/smarthttp.go
internal/gitaly/smarthttp.go
+2
-1
internal/testhelper/gitaly.go
internal/testhelper/gitaly.go
+1
-0
main_test.go
main_test.go
+3
-2
No files found.
gitaly_test.go
View file @
5b0f3acd
...
@@ -31,8 +31,9 @@ func TestFailedCloneNoGitaly(t *testing.T) {
...
@@ -31,8 +31,9 @@ func TestFailedCloneNoGitaly(t *testing.T) {
require
.
NoError
(
t
,
os
.
RemoveAll
(
scratchDir
))
require
.
NoError
(
t
,
os
.
RemoveAll
(
scratchDir
))
authBody
:=
&
api
.
Response
{
authBody
:=
&
api
.
Response
{
GL_ID
:
"user-123"
,
GL_ID
:
"user-123"
,
RepoPath
:
repoPath
(
t
),
GL_USERNAME
:
"username"
,
RepoPath
:
repoPath
(
t
),
// This will create a failure to connect to Gitaly
// This will create a failure to connect to Gitaly
GitalyServer
:
gitaly
.
Server
{
Address
:
"unix:/nonexistent"
},
GitalyServer
:
gitaly
.
Server
{
Address
:
"unix:/nonexistent"
},
}
}
...
@@ -132,6 +133,7 @@ func TestPostReceivePackProxiedToGitalySuccessfully(t *testing.T) {
...
@@ -132,6 +133,7 @@ func TestPostReceivePackProxiedToGitalySuccessfully(t *testing.T) {
apiResponse
.
Repository
.
StorageName
,
apiResponse
.
Repository
.
StorageName
,
apiResponse
.
Repository
.
RelativePath
,
apiResponse
.
Repository
.
RelativePath
,
apiResponse
.
GL_ID
,
apiResponse
.
GL_ID
,
apiResponse
.
GL_USERNAME
,
string
(
testhelper
.
GitalyReceivePackResponseMock
),
string
(
testhelper
.
GitalyReceivePackResponseMock
),
},
"
\0
00"
)
},
"
\0
00"
)
...
...
internal/git/receive-pack.go
View file @
5b0f3acd
...
@@ -52,7 +52,7 @@ func handleReceivePackWithGitaly(ctx context.Context, a *api.Response, clientReq
...
@@ -52,7 +52,7 @@ func handleReceivePackWithGitaly(ctx context.Context, a *api.Response, clientReq
return
fmt
.
Errorf
(
"smarthttp.ReceivePack: %v"
,
err
)
return
fmt
.
Errorf
(
"smarthttp.ReceivePack: %v"
,
err
)
}
}
if
err
:=
smarthttp
.
ReceivePack
(
ctx
,
&
a
.
Repository
,
a
.
GL_ID
,
a
.
GL_REPOSITORY
,
clientRequest
,
clientResponse
);
err
!=
nil
{
if
err
:=
smarthttp
.
ReceivePack
(
ctx
,
&
a
.
Repository
,
a
.
GL_ID
,
a
.
GL_
USERNAME
,
a
.
GL_
REPOSITORY
,
clientRequest
,
clientResponse
);
err
!=
nil
{
return
fmt
.
Errorf
(
"smarthttp.ReceivePack: %v"
,
err
)
return
fmt
.
Errorf
(
"smarthttp.ReceivePack: %v"
,
err
)
}
}
...
...
internal/gitaly/smarthttp.go
View file @
5b0f3acd
...
@@ -39,7 +39,7 @@ func infoRefsReader(stream infoRefsClient) io.Reader {
...
@@ -39,7 +39,7 @@ func infoRefsReader(stream infoRefsClient) io.Reader {
})
})
}
}
func
(
client
*
SmartHTTPClient
)
ReceivePack
(
ctx
context
.
Context
,
repo
*
pb
.
Repository
,
glId
string
,
glRepository
string
,
clientRequest
io
.
Reader
,
clientResponse
io
.
Writer
)
error
{
func
(
client
*
SmartHTTPClient
)
ReceivePack
(
ctx
context
.
Context
,
repo
*
pb
.
Repository
,
glId
string
,
gl
Username
string
,
gl
Repository
string
,
clientRequest
io
.
Reader
,
clientResponse
io
.
Writer
)
error
{
stream
,
err
:=
client
.
PostReceivePack
(
ctx
)
stream
,
err
:=
client
.
PostReceivePack
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -48,6 +48,7 @@ func (client *SmartHTTPClient) ReceivePack(ctx context.Context, repo *pb.Reposit
...
@@ -48,6 +48,7 @@ func (client *SmartHTTPClient) ReceivePack(ctx context.Context, repo *pb.Reposit
rpcRequest
:=
&
pb
.
PostReceivePackRequest
{
rpcRequest
:=
&
pb
.
PostReceivePackRequest
{
Repository
:
repo
,
Repository
:
repo
,
GlId
:
glId
,
GlId
:
glId
,
GlUsername
:
glUsername
,
GlRepository
:
glRepository
,
GlRepository
:
glRepository
,
}
}
...
...
internal/testhelper/gitaly.go
View file @
5b0f3acd
...
@@ -99,6 +99,7 @@ func (s *GitalyTestServer) PostReceivePack(stream pb.SmartHTTPService_PostReceiv
...
@@ -99,6 +99,7 @@ func (s *GitalyTestServer) PostReceivePack(stream pb.SmartHTTPService_PostReceiv
repo
.
GetStorageName
(),
repo
.
GetStorageName
(),
repo
.
GetRelativePath
(),
repo
.
GetRelativePath
(),
req
.
GlId
,
req
.
GlId
,
req
.
GlUsername
,
},
"
\0
00"
)
+
"
\0
00"
)
},
"
\0
00"
)
+
"
\0
00"
)
// The body of the request starts in the second message
// The body of the request starts in the second message
...
...
main_test.go
View file @
5b0f3acd
...
@@ -722,8 +722,9 @@ func runOrFail(t *testing.T, cmd *exec.Cmd) {
...
@@ -722,8 +722,9 @@ func runOrFail(t *testing.T, cmd *exec.Cmd) {
func
gitOkBody
(
t
*
testing
.
T
)
*
api
.
Response
{
func
gitOkBody
(
t
*
testing
.
T
)
*
api
.
Response
{
repoPath
:=
repoPath
(
t
)
repoPath
:=
repoPath
(
t
)
return
&
api
.
Response
{
return
&
api
.
Response
{
GL_ID
:
"user-123"
,
GL_ID
:
"user-123"
,
RepoPath
:
repoPath
,
GL_USERNAME
:
"username"
,
RepoPath
:
repoPath
,
Repository
:
pb
.
Repository
{
Repository
:
pb
.
Repository
{
StorageName
:
"default"
,
StorageName
:
"default"
,
RelativePath
:
"foo/bar.git"
,
RelativePath
:
"foo/bar.git"
,
...
...
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