summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-10-05 12:45:15 +0200
committerRémy Coutable <remy@rymai.me>2017-10-05 12:45:15 +0200
commita5850041d36300420fe9126960e0ca229d10d0e1 (patch)
tree77c6c883a33b40ddc614bb67ec4b7d2c8df1b012
parent7833d3fb29592daa774124dedca692b921e1545c (diff)
downloadgitlab-ce-a5850041d36300420fe9126960e0ca229d10d0e1.tar.gz
Minor improvements after latest review
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--app/models/concerns/repository_mirroring.rb12
-rw-r--r--lib/github/representation/issuable.rb4
-rw-r--r--lib/github/representation/issue.rb4
3 files changed, 6 insertions, 14 deletions
diff --git a/app/models/concerns/repository_mirroring.rb b/app/models/concerns/repository_mirroring.rb
index 6d84d8dc342..fbdc9b67107 100644
--- a/app/models/concerns/repository_mirroring.rb
+++ b/app/models/concerns/repository_mirroring.rb
@@ -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
diff --git a/lib/github/representation/issuable.rb b/lib/github/representation/issuable.rb
index 348b26ea902..768ba3b993c 100644
--- a/lib/github/representation/issuable.rb
+++ b/lib/github/representation/issuable.rb
@@ -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
diff --git a/lib/github/representation/issue.rb b/lib/github/representation/issue.rb
index 0e595301c58..4f1a02cb90f 100644
--- a/lib/github/representation/issue.rb
+++ b/lib/github/representation/issue.rb
@@ -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