Minor improvements after latest review
Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
7833d3fb29
commit
a5850041d3
|
@ -1,8 +1,6 @@
|
|||
module RepositoryMirroring
|
||||
IMPORT_REFS = %w[
|
||||
+refs/heads/*:refs/heads/*
|
||||
+refs/tags/*:refs/tags/*
|
||||
].freeze
|
||||
IMPORT_HEAD_REFS = '+refs/heads/*:refs/heads/*'.freeze
|
||||
IMPORT_TAG_REFS = '+refs/tags/*:refs/tags/*'.freeze
|
||||
|
||||
def set_remote_as_mirror(name)
|
||||
# This is used to define repository as equivalent as "git clone --mirror"
|
||||
|
@ -13,11 +11,9 @@ module RepositoryMirroring
|
|||
|
||||
def set_import_remote_as_mirror(remote_name)
|
||||
# Add first fetch with Rugged so it does not create its own.
|
||||
raw_repository.rugged.config["remote.#{remote_name}.fetch"] = IMPORT_REFS.first
|
||||
raw_repository.rugged.config["remote.#{remote_name}.fetch"] = IMPORT_HEAD_REFS
|
||||
|
||||
IMPORT_REFS.drop(1).each do |refspec|
|
||||
add_remote_fetch_config(remote_name, refspec)
|
||||
end
|
||||
add_remote_fetch_config(remote_name, IMPORT_TAG_REFS)
|
||||
|
||||
raw_repository.rugged.config["remote.#{remote_name}.mirror"] = true
|
||||
raw_repository.rugged.config["remote.#{remote_name}.prune"] = true
|
||||
|
|
|
@ -28,9 +28,7 @@ module Github
|
|||
end
|
||||
|
||||
def labels
|
||||
return [] unless labels?
|
||||
|
||||
@labels ||= raw['labels'].map do |label|
|
||||
@labels ||= Array(raw['labels']).map do |label|
|
||||
Github::Representation::Label.new(label, options)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,9 +18,7 @@ module Github
|
|||
end
|
||||
|
||||
def assignees
|
||||
return [] unless assigned?
|
||||
|
||||
@assignees ||= raw['assignees'].map do |user|
|
||||
@assignees ||= Array(raw['assignees']).map do |user|
|
||||
Github::Representation::User.new(user, options)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue