diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-09 06:29:46 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-09 06:30:19 -0700 |
commit | 31f2608161945d3c1189509955d68209934e2988 (patch) | |
tree | 33b91a667cae2ead7f35efc7a92370091e2b8538 /spec/lib/extracts_path_spec.rb | |
parent | 0ed8f3490e037d451841ec0e6fe226b9e62e8466 (diff) | |
download | gitlab-ce-31f2608161945d3c1189509955d68209934e2988.tar.gz |
Fix handling of annotated tags when Gitaly is not in use
Attempting to view an annotated tag in the TreeController would result
in `NoMethodError: undefined method 'tree'` when Rugged was in use.
`Blob#find_by_rugged` assumes that the ref is a true. Using
the commit ID ensures that the right ref is being used.
Note that in 11.1, `Blob#find` no longer uses Rugged, so this is only
a bug in 11.0.
Closes gitlab-org/gitlab-ce#47797
Diffstat (limited to 'spec/lib/extracts_path_spec.rb')
-rw-r--r-- | spec/lib/extracts_path_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb index e13406d1972..8947e2ac4fb 100644 --- a/spec/lib/extracts_path_spec.rb +++ b/spec/lib/extracts_path_spec.rb @@ -203,4 +203,30 @@ describe ExtractsPath do expect(extract_ref_without_atom('foo.atom')).to eq(nil) end end + + describe '#lfs_blob_ids' do + shared_examples '#lfs_blob_ids' do + let(:tag) { @project.repository.add_tag(@project.owner, 'my-annotated-tag', 'master', 'test tag') } + let(:ref) { tag.target } + let(:params) { { ref: ref, path: 'README.md' } } + + before do + @project = create(:project, :repository) + end + + it 'handles annotated tags' do + assign_ref_vars + + expect(lfs_blob_ids).to eq([]) + end + end + + context 'when gitaly is enabled' do + it_behaves_like '#lfs_blob_ids' + end + + context 'when gitaly is disabled', :skip_gitaly_mock do + it_behaves_like '#lfs_blob_ids' + end + end end |