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
05c65c3c
Commit
05c65c3c
authored
Aug 19, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Projects::UpdateMirrorService to allow tags pointing to blob objects
parent
4d3f34bd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/services/projects/update_mirror_service.rb
app/services/projects/update_mirror_service.rb
+8
-2
spec/services/projects/update_mirror_service_spec.rb
spec/services/projects/update_mirror_service_spec.rb
+12
-0
No files found.
CHANGELOG-EE
View file @
05c65c3c
...
...
@@ -15,6 +15,7 @@ v 8.11.0 (unreleased)
- [Elastic] Significant improvement of global search performance
- [Fix] Push rules check existing commits in some cases
- [ES] Limit amount of retries for sidekiq jobs
- Fix Projects::UpdateMirrorService to allow tags pointing to blob objects
v 8.10.6
- Fix race condition with UpdateMirrorWorker Lease. !641
...
...
app/services/projects/update_mirror_service.rb
View file @
05c65c3c
...
...
@@ -62,14 +62,14 @@ module Projects
end
def
update_tags
(
&
block
)
old_tags
=
repository
.
tags
.
each_with_object
({})
{
|
tag
,
tags
|
tags
[
tag
.
name
]
=
tag
}
old_tags
=
repository
_tags_with_target
.
each_with_object
({})
{
|
tag
,
tags
|
tags
[
tag
.
name
]
=
tag
}
fetch_result
=
block
.
call
return
fetch_result
unless
fetch_result
repository
.
expire_tags_cache
tags
=
repository
.
tags
tags
=
repository
_tags_with_target
tags
.
each
do
|
tag
|
old_tag
=
old_tags
[
tag
.
name
]
...
...
@@ -92,5 +92,11 @@ module Projects
fetch_result
end
# In Git is possible to tag blob objects, and those blob objects don't point to a Git commit so those tags
# have no target.
def
repository_tags_with_target
repository
.
tags
.
select
(
&
:target
)
end
end
end
spec/services/projects/update_mirror_service_spec.rb
View file @
05c65c3c
...
...
@@ -26,6 +26,15 @@ describe Projects::UpdateMirrorService do
expect
(
project
.
repository
.
tag_names
).
to
include
(
'new-tag'
)
end
it
"only invokes GitTagPushService for tags pointing to commits"
do
stub_fetch_mirror
(
project
)
expect
(
GitTagPushService
).
to
receive
(
:new
).
with
(
project
,
project
.
owner
,
hash_including
(
ref:
'refs/tags/new-tag'
)).
and_return
(
double
(
execute:
true
))
described_class
.
new
(
project
,
project
.
owner
).
execute
end
end
describe
"updating branches"
do
...
...
@@ -112,5 +121,8 @@ describe Projects::UpdateMirrorService do
# New tag
rugged
.
references
.
create
(
'refs/tags/new-tag'
,
masterrev
)
# New tag that point to a blob
rugged
.
references
.
create
(
'refs/tags/new-tag-on-blob'
,
'c74175afd117781cbc983664339a0f599b5bb34e'
)
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