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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
4a251849
Commit
4a251849
authored
Mar 06, 2014
by
Jeroen van Baarsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added newrev and oldrev to the hook data
parent
f096bd61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
app/services/git_tag_push_service.rb
app/services/git_tag_push_service.rb
+5
-3
app/workers/post_receive.rb
app/workers/post_receive.rb
+1
-1
spec/services/git_tag_push_service_spec.rb
spec/services/git_tag_push_service_spec.rb
+6
-2
No files found.
app/services/git_tag_push_service.rb
View file @
4a251849
class
GitTagPushService
class
GitTagPushService
attr_accessor
:project
,
:user
,
:push_data
attr_accessor
:project
,
:user
,
:push_data
def
execute
(
project
,
user
,
ref
)
def
execute
(
project
,
user
,
oldrev
,
newrev
,
ref
)
@project
,
@user
=
project
,
user
@project
,
@user
=
project
,
user
@push_data
=
create_push_data
(
ref
)
@push_data
=
create_push_data
(
oldrev
,
newrev
,
ref
)
project
.
execute_hooks
(
@push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_hooks
(
@push_data
.
dup
,
:tag_push_hooks
)
end
end
private
private
def
create_push_data
(
ref
)
def
create_push_data
(
oldrev
,
newrev
,
ref
)
data
=
{
data
=
{
ref:
ref
,
ref:
ref
,
oldrev:
oldrev
,
newrev:
newrev
,
user_id:
user
.
id
,
user_id:
user
.
id
,
user_name:
user
.
name
,
user_name:
user
.
name
,
project_id:
project
.
id
,
project_id:
project
.
id
,
...
...
app/workers/post_receive.rb
View file @
4a251849
...
@@ -30,7 +30,7 @@ class PostReceive
...
@@ -30,7 +30,7 @@ class PostReceive
end
end
if
tag?
(
ref
)
if
tag?
(
ref
)
GitTagPushService
.
new
.
execute
(
project
,
user
,
ref
)
GitTagPushService
.
new
.
execute
(
project
,
user
,
oldrev
,
newrev
,
ref
)
else
else
GitPushService
.
new
.
execute
(
project
,
user
,
oldrev
,
newrev
,
ref
)
GitPushService
.
new
.
execute
(
project
,
user
,
oldrev
,
newrev
,
ref
)
end
end
...
...
spec/services/git_tag_push_service_spec.rb
View file @
4a251849
...
@@ -7,17 +7,21 @@ describe GitTagPushService do
...
@@ -7,17 +7,21 @@ describe GitTagPushService do
before
do
before
do
@ref
=
'refs/tags/super-tag'
@ref
=
'refs/tags/super-tag'
@oldrev
=
'b98a310def241a6fd9c9a9a3e7934c48e498fe81'
@newrev
=
'b19a04f53caeebf4fe5ec2327cb83e9253dc91bb'
end
end
describe
'Git Tag Push Data'
do
describe
'Git Tag Push Data'
do
before
do
before
do
service
.
execute
(
project
,
user
,
@ref
)
service
.
execute
(
project
,
user
,
@
oldrev
,
@newrev
,
@
ref
)
@push_data
=
service
.
push_data
@push_data
=
service
.
push_data
end
end
subject
{
@push_data
}
subject
{
@push_data
}
it
{
should
include
(
ref:
@ref
)
}
it
{
should
include
(
ref:
@ref
)
}
it
{
should
include
(
oldrev:
@oldrev
)
}
it
{
should
include
(
newrev:
@newrev
)
}
it
{
should
include
(
user_id:
user
.
id
)
}
it
{
should
include
(
user_id:
user
.
id
)
}
it
{
should
include
(
user_name:
user
.
name
)
}
it
{
should
include
(
user_name:
user
.
name
)
}
it
{
should
include
(
project_id:
project
.
id
)
}
it
{
should
include
(
project_id:
project
.
id
)
}
...
@@ -36,7 +40,7 @@ describe GitTagPushService do
...
@@ -36,7 +40,7 @@ describe GitTagPushService do
context
"execute web hooks"
do
context
"execute web hooks"
do
it
"when pushing tags"
do
it
"when pushing tags"
do
project
.
should_receive
(
:execute_hooks
)
project
.
should_receive
(
:execute_hooks
)
service
.
execute
(
project
,
user
,
'refs/tags/v1.0.0'
)
service
.
execute
(
project
,
user
,
'
oldrev'
,
'newrev'
,
'
refs/tags/v1.0.0'
)
end
end
end
end
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