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
Léo-Paul Géneau
gitlab-ce
Commits
9e6cdc64
Commit
9e6cdc64
authored
Nov 28, 2016
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Pass correct tag target to post-receive hook when creating tag via UI"
This reverts commit
ae51774b
.
parent
6ea0b8d5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
32 deletions
+3
-32
app/models/repository.rb
app/models/repository.rb
+3
-10
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+0
-22
No files found.
app/models/repository.rb
View file @
9e6cdc64
...
...
@@ -196,18 +196,11 @@ class Repository
options
=
{
message:
message
,
tagger:
user_to_committer
(
user
)
}
if
message
GitHooksService
.
new
.
execute
(
user
,
path_to_repo
,
oldrev
,
target
,
ref
)
do
rugged
.
tags
.
create
(
tag_name
,
target
,
options
)
tag
=
find_tag
(
tag_name
)
GitHooksService
.
new
.
execute
(
user
,
path_to_repo
,
oldrev
,
tag
.
target
,
ref
)
do
# we already created a tag, because we need tag SHA to pass correct
# values to hooks
end
tag
rescue
GitHooksService
::
PreReceiveError
rugged
.
tags
.
delete
(
tag_name
)
raise
find_tag
(
tag_name
)
end
def
rm_branch
(
user
,
branch_name
)
...
...
spec/models/repository_spec.rb
View file @
9e6cdc64
...
...
@@ -1303,28 +1303,6 @@ describe Repository, models: true do
repository
.
add_tag
(
user
,
'8.5'
,
'master'
,
'foo'
)
end
it
'does not create a tag when a pre-hook fails'
do
allow_any_instance_of
(
Gitlab
::
Git
::
Hook
).
to
receive
(
:trigger
).
and_return
([
false
,
''
])
expect
do
repository
.
add_tag
(
user
,
'8.5'
,
'master'
,
'foo'
)
end
.
to
raise_error
(
GitHooksService
::
PreReceiveError
)
repository
.
expire_tags_cache
expect
(
repository
.
find_tag
(
'8.5'
)).
to
be_nil
end
it
'passes tag SHA to hooks'
do
spy
=
GitHooksService
.
new
allow
(
GitHooksService
).
to
receive
(
:new
).
and_return
(
spy
)
allow
(
spy
).
to
receive
(
:execute
).
and_call_original
tag
=
repository
.
add_tag
(
user
,
'8.5'
,
'master'
,
'foo'
)
expect
(
spy
).
to
have_received
(
:execute
).
with
(
anything
,
anything
,
anything
,
tag
.
target
,
anything
)
end
it
'returns a Gitlab::Git::Tag object'
do
tag
=
repository
.
add_tag
(
user
,
'8.5'
,
'master'
,
'foo'
)
...
...
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