diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-01-27 16:12:26 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-01-27 16:12:26 +0000 |
commit | 6ccc4eb42a05d4ce8b75773723305bd82305dfec (patch) | |
tree | 5b696abbf82ac7276f92efaf6dd425d544cf4a54 /spec/models/repository_spec.rb | |
parent | d777e6f1da98be64b872a2bea2222f3e037a3d4d (diff) | |
parent | d09fdfd6c72e544fa3156a13cad59a791e977dce (diff) | |
download | gitlab-ce-6ccc4eb42a05d4ce8b75773723305bd82305dfec.tar.gz |
Merge branch 'sh-fix-annotated-tags-pointing-to-blob' into 'master'
Fix Error 500 when repositories contain annotated tags pointing to blobs
Closes #27228
See merge request !8800
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r-- | spec/models/repository_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 1670f5e3ab0..829b69093c9 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -90,6 +90,30 @@ describe Repository, models: true do it { is_expected.to eq(['v1.1.0', 'v1.0.0']) } end + + context 'annotated tag pointing to a blob' do + let(:annotated_tag_name) { 'annotated-tag' } + + subject { repository.tags_sorted_by('updated_asc').map(&:name) } + + before do + options = { message: 'test tag message\n', + tagger: { name: 'John Smith', email: 'john@gmail.com' } } + repository.rugged.tags.create(annotated_tag_name, 'a48e4fc218069f68ef2e769dd8dfea3991362175', options) + + double_first = double(committed_date: Time.now - 1.second) + double_last = double(committed_date: Time.now) + + allow(tag_a).to receive(:dereferenced_target).and_return(double_last) + allow(tag_b).to receive(:dereferenced_target).and_return(double_first) + end + + it { is_expected.to eq(['v1.1.0', 'v1.0.0', annotated_tag_name]) } + + after do + repository.rugged.tags.delete(annotated_tag_name) + end + end end end |