Commit a5850041 authored by Rémy Coutable's avatar Rémy Coutable

Minor improvements after latest review

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 7833d3fb
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment