BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7ece18f1
Commit
7ece18f1
authored
Oct 26, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gl-username-hook-fix' into 'master'
Fix the incorrect value being used to set GL_USERNAME on hooks See merge request gitlab-org/gitlab-ce!15038
parents
cd08fd23
42a45392
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
hooks_service.rb
lib/gitlab/git/hooks_service.rb
+1
-1
hooks_service_spec.rb
spec/lib/gitlab/git/hooks_service_spec.rb
+15
-13
No files found.
lib/gitlab/git/hooks_service.rb
View file @
7ece18f1
...
...
@@ -8,7 +8,7 @@ module Gitlab
def
execute
(
pusher
,
repository
,
oldrev
,
newrev
,
ref
)
@repository
=
repository
@gl_id
=
pusher
.
gl_id
@gl_username
=
pusher
.
name
@gl_username
=
pusher
.
user
name
@oldrev
=
oldrev
@newrev
=
newrev
@ref
=
ref
...
...
spec/lib/gitlab/git/hooks_service_spec.rb
View file @
7ece18f1
require
'spec_helper'
describe
Gitlab
::
Git
::
HooksService
,
seed_helper:
true
do
let
(
:user
)
{
Gitlab
::
Git
::
User
.
new
(
'janedoe'
,
'Jane Doe'
,
'janedoe@example.com'
,
'user-456'
)
}
let
(
:gl_id
)
{
'user-456'
}
let
(
:gl_username
)
{
'janedoe'
}
let
(
:user
)
{
Gitlab
::
Git
::
User
.
new
(
gl_username
,
'Jane Doe'
,
'janedoe@example.com'
,
gl_id
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
'project-123'
)
}
let
(
:service
)
{
described_class
.
new
}
before
do
@blankrev
=
Gitlab
::
Git
::
BLANK_SHA
@oldrev
=
SeedRepo
::
Commit
::
PARENT_ID
@newrev
=
SeedRepo
::
Commit
::
ID
@ref
=
'refs/heads/feature'
end
let
(
:blankrev
)
{
Gitlab
::
Git
::
BLANK_SHA
}
let
(
:oldrev
)
{
SeedRepo
::
Commit
::
PARENT_ID
}
let
(
:newrev
)
{
SeedRepo
::
Commit
::
ID
}
let
(
:ref
)
{
'refs/heads/feature'
}
describe
'#execute'
do
context
'when receive hooks were successful'
do
it
'calls post-receive hook'
do
hook
=
double
(
trigger:
[
true
,
nil
])
let
(
:hook
)
{
double
(
:hook
)
}
it
'calls all three hooks'
do
expect
(
Gitlab
::
Git
::
Hook
).
to
receive
(
:new
).
exactly
(
3
).
times
.
and_return
(
hook
)
expect
(
hook
).
to
receive
(
:trigger
).
with
(
gl_id
,
gl_username
,
blankrev
,
newrev
,
ref
)
.
exactly
(
3
).
times
.
and_return
([
true
,
nil
])
service
.
execute
(
user
,
repository
,
@blankrev
,
@newrev
,
@
ref
)
{
}
service
.
execute
(
user
,
repository
,
blankrev
,
newrev
,
ref
)
{
}
end
end
...
...
@@ -28,7 +30,7 @@ describe Gitlab::Git::HooksService, seed_helper: true do
expect
(
service
).
not_to
receive
(
:run_hook
).
with
(
'post-receive'
)
expect
do
service
.
execute
(
user
,
repository
,
@blankrev
,
@newrev
,
@
ref
)
service
.
execute
(
user
,
repository
,
blankrev
,
newrev
,
ref
)
end
.
to
raise_error
(
Gitlab
::
Git
::
HooksService
::
PreReceiveError
)
end
end
...
...
@@ -40,7 +42,7 @@ describe Gitlab::Git::HooksService, seed_helper: true do
expect
(
service
).
not_to
receive
(
:run_hook
).
with
(
'post-receive'
)
expect
do
service
.
execute
(
user
,
repository
,
@blankrev
,
@newrev
,
@
ref
)
service
.
execute
(
user
,
repository
,
blankrev
,
newrev
,
ref
)
end
.
to
raise_error
(
Gitlab
::
Git
::
HooksService
::
PreReceiveError
)
end
end
...
...
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