Tags are migrated to Gitaly
Closes https://gitlab.com/gitlab-org/gitaly/issues/390
This commit is contained in:
parent
36d75be393
commit
143a632ebe
1 changed files with 2 additions and 32 deletions
|
@ -273,12 +273,8 @@ module Gitlab
|
||||||
#
|
#
|
||||||
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/390
|
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/390
|
||||||
def tags
|
def tags
|
||||||
gitaly_migrate(:tags, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
|
wrapped_gitaly_errors do
|
||||||
if is_enabled
|
gitaly_ref_client.tags
|
||||||
tags_from_gitaly
|
|
||||||
else
|
|
||||||
tags_from_rugged
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1931,37 +1927,11 @@ module Gitlab
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def tags_from_rugged
|
|
||||||
rugged.references.each("refs/tags/*").map do |ref|
|
|
||||||
message = nil
|
|
||||||
|
|
||||||
if ref.target.is_a?(Rugged::Tag::Annotation)
|
|
||||||
tag_message = ref.target.message
|
|
||||||
|
|
||||||
if tag_message.respond_to?(:chomp)
|
|
||||||
message = tag_message.chomp
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
target_commit = Gitlab::Git::Commit.find(self, ref.target)
|
|
||||||
Gitlab::Git::Tag.new(self, {
|
|
||||||
name: ref.name,
|
|
||||||
target: ref.target,
|
|
||||||
target_commit: target_commit,
|
|
||||||
message: message
|
|
||||||
})
|
|
||||||
end.sort_by(&:name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def last_commit_for_path_by_rugged(sha, path)
|
def last_commit_for_path_by_rugged(sha, path)
|
||||||
sha = last_commit_id_for_path_by_shelling_out(sha, path)
|
sha = last_commit_id_for_path_by_shelling_out(sha, path)
|
||||||
commit(sha)
|
commit(sha)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tags_from_gitaly
|
|
||||||
gitaly_ref_client.tags
|
|
||||||
end
|
|
||||||
|
|
||||||
def size_by_shelling_out
|
def size_by_shelling_out
|
||||||
popen(%w(du -sk), path).first.strip.to_i
|
popen(%w(du -sk), path).first.strip.to_i
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue