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
a892b235
Commit
a892b235
authored
Jul 21, 2018
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tag a commit via `/tag 1.2.3 message`
parent
cc1aecdb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
1 deletion
+67
-1
app/services/commits/update_service.rb
app/services/commits/update_service.rb
+20
-1
spec/services/commits/update_service_spec.rb
spec/services/commits/update_service_spec.rb
+47
-0
No files found.
app/services/commits/update_service.rb
View file @
a892b235
...
...
@@ -3,7 +3,26 @@
module
Commits
class
UpdateService
<
BaseService
def
execute
(
commit
)
# TODO authorize user
tag_commit
(
commit
)
end
private
def
tag_commit
(
commit
)
# TODO authorize
return
unless
params
[
:tag_name
]
tag_name
=
params
[
:tag_name
]
message
=
params
[
:tag_message
]
release_description
=
nil
result
=
Tags
::
CreateService
.
new
(
commit
.
project
,
current_user
)
.
execute
(
tag_name
,
commit
.
sha
,
message
,
release_description
)
if
result
[
:status
]
commit
end
end
end
end
spec/services/commits/update_service_spec.rb
0 → 100644
View file @
a892b235
require
'spec_helper'
describe
Commits
::
UpdateService
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
create
(
:commit
,
project:
project
)
}
before
do
project
.
add_maintainer
(
user
)
end
describe
'execute'
do
let
(
:service
)
{
described_class
.
new
(
project
,
user
,
opts
)
}
context
'valid params'
do
let
(
:opts
)
do
{
tag_name:
'1.2.3'
,
tag_message:
'Release'
}
end
it
'tags a commit'
do
tag_stub
=
instance_double
(
Tags
::
CreateService
)
allow
(
Tags
::
CreateService
).
to
receive
(
:new
).
and_return
(
tag_stub
)
allow
(
tag_stub
).
to
receive
(
:execute
)
.
with
(
opts
[
:tag_name
],
commit
.
sha
,
opts
[
:tag_message
],
nil
)
.
and_return
({
status: :success
})
service
.
execute
(
commit
)
end
end
context
'invalid params'
do
let
(
:opts
)
do
{}
end
it
'does not call the tag create service'
do
expect
(
Tags
::
CreateService
).
not_to
receive
(
:new
)
service
.
execute
(
commit
)
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