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

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
parents cbee84ca 3f0c9e97
......@@ -78,7 +78,7 @@ module Gitlab
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 @@ module Gitlab
raise RemoteError, error unless exit_code.zero?
tag_list.split('\n')
tag_list.split("\n")
end
end
end
......
......@@ -629,16 +629,29 @@ describe Gitlab::Git::Repository, seed_helper: true do
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