Commit 078764e4 authored by Rémy Coutable's avatar Rémy Coutable Committed by Winnie Hellmann
Browse files

Merge branch...

Merge branch '40300-cannot-list-tags-in-a-repository-mirror-when-hashed-storage-in-use' into 'master'

Fix Gitlab::Git::Repository#remote_tags using unexisting variable

Closes #40300

See merge request gitlab-org/gitlab-ce!15466

(cherry picked from commit c563661f910934f1103690d46f9af8a75423077d)

63beaa32 Fix Gitlab::Git::Repository#remote_tags using unexisting variable
d622a8c5 Merge branch 'master' into 40300-cannot-list-tags-in-a-repository-mirror-when-hashed-storage-in-use
parent 385d6af5e099
......@@ -78,7 +78,7 @@ def remote_branches(remote_name)
def list_remote_tags(remote)
tag_list, exit_code, error = nil
cmd = %W(#{Gitlab.config.git.bin_path} --git-dir=#{full_path} ls-remote --tags #{remote})
cmd = %W(#{Gitlab.config.git.bin_path} --git-dir=#{path} ls-remote --tags #{remote})
Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thr|
tag_list = stdout.read
......@@ -88,7 +88,7 @@ def list_remote_tags(remote)
raise RemoteError, error unless exit_code.zero?
tag_list.split('\n')
tag_list.split("\n")
end
end
end
......
......@@ -634,16 +634,29 @@ def submodule_url(path)
end
describe '#remote_tags' do
let(:remote_name) { 'upstream' }
let(:target_commit_id) { SeedRepo::Commit::ID }
let(:user) { create(:user) }
let(:tag_name) { 'v0.0.1' }
let(:tag_message) { 'My tag' }
let(:remote_repository) do
Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
end
subject { repository.remote_tags('upstream') }
subject { repository.remote_tags(remote_name) }
it 'gets the remote tags' do
expect(repository).to receive(:list_remote_tags).with('upstream')
.and_return(["#{target_commit_id}\trefs/tags/v0.0.1\n"])
before do
repository.add_remote(remote_name, remote_repository.path)
remote_repository.add_tag(tag_name, user: user, target: target_commit_id)
end
after do
ensure_seeds
end
it 'gets the remote tags' do
expect(subject.first).to be_an_instance_of(Gitlab::Git::Tag)
expect(subject.first.name).to eq('v0.0.1')
expect(subject.first.name).to eq(tag_name)
expect(subject.first.dereferenced_target.id).to eq(target_commit_id)
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