Fix Gitlab::Git::Repository#remote_tags using unexisting variable
This commit is contained in:
parent
cbee84ca29
commit
3f0c9e9708
2 changed files with 20 additions and 7 deletions
|
@ -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) }
|
||||
|
||||
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(repository).to receive(:list_remote_tags).with('upstream')
|
||||
.and_return(["#{target_commit_id}\trefs/tags/v0.0.1\n"])
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue