Test git builder over annotated tag
This commit is contained in:
parent
a0d4235c04
commit
de27375d6c
|
@ -66,8 +66,11 @@ module Gitlab
|
||||||
if newrev != Gitlab::Git::BLANK_SHA && ref.start_with?('refs/tags/')
|
if newrev != Gitlab::Git::BLANK_SHA && ref.start_with?('refs/tags/')
|
||||||
tag_name = Gitlab::Git.extract_ref_name(ref)
|
tag_name = Gitlab::Git.extract_ref_name(ref)
|
||||||
tag = repository.find_tag(tag_name)
|
tag = repository.find_tag(tag_name)
|
||||||
commit = repository.commit(tag.target)
|
|
||||||
commit.try(:sha)
|
if tag
|
||||||
|
commit = repository.commit(tag.target)
|
||||||
|
commit.try(:sha)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
newrev
|
newrev
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,13 +21,14 @@ describe 'Gitlab::PushDataBuilder' do
|
||||||
Gitlab::PushDataBuilder.build(project,
|
Gitlab::PushDataBuilder.build(project,
|
||||||
user,
|
user,
|
||||||
Gitlab::Git::BLANK_SHA,
|
Gitlab::Git::BLANK_SHA,
|
||||||
'5937ac0a7beb003549fc5fd26fc247adbce4a52e',
|
'8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b',
|
||||||
'refs/tags/v1.1.0')
|
'refs/tags/v1.1.0')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { data.should be_a(Hash) }
|
it { data.should be_a(Hash) }
|
||||||
it { data[:before].should == Gitlab::Git::BLANK_SHA }
|
it { data[:before].should == Gitlab::Git::BLANK_SHA }
|
||||||
it { data[:after].should == '5937ac0a7beb003549fc5fd26fc247adbce4a52e' }
|
it { data[:checkout_sha].should == '5937ac0a7beb003549fc5fd26fc247adbce4a52e' }
|
||||||
|
it { data[:after].should == '8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b' }
|
||||||
it { data[:ref].should == 'refs/tags/v1.1.0' }
|
it { data[:ref].should == 'refs/tags/v1.1.0' }
|
||||||
it { data[:commits].should be_empty }
|
it { data[:commits].should be_empty }
|
||||||
it { data[:total_commits_count].should be_zero }
|
it { data[:total_commits_count].should be_zero }
|
||||||
|
|
Loading…
Reference in New Issue