Rename 'limit' to 'blob_size_limit'
This commit is contained in:
		
							parent
							
								
									5e20e448ce
								
							
						
					
					
						commit
						29a1c5a126
					
				|  | @ -51,18 +51,17 @@ module Gitlab | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|         # Returns an array of Blob instances, specified in blob_references as |         # Returns an array of Blob instances, specified in blob_references as | ||||||
|         # [[commit_sha, path], [commit_sha, path], ...]. If limit < 0 then the |         # [[commit_sha, path], [commit_sha, path], ...]. If blob_size_limit < 0 then the | ||||||
|         # full blob contents are returned. If limit >= 0 then each blob will |         # full blob contents are returned. If blob_size_limit >= 0 then each blob will | ||||||
|         # contain no more than limit bytes in its data attribute. |         # contain no more than limit bytes in its data attribute. | ||||||
|         #  |         #  | ||||||
|         # Keep in mind that this method may allocate a lot of memory. It is up |         # Keep in mind that this method may allocate a lot of memory. It is up | ||||||
|         # to the caller to limit the number of blobs and/or the content limit |         # to the caller to limit the number of blobs and blob_size_limit. | ||||||
|         # for the individual blobs. |  | ||||||
|         # |         # | ||||||
|         def batch(repository, blob_references, limit: nil) |         def batch(repository, blob_references, blob_size_limit: nil) | ||||||
|           limit ||= MAX_DATA_DISPLAY_SIZE |           blob_size_limit ||= MAX_DATA_DISPLAY_SIZE | ||||||
|           blob_references.map do |sha, path| |           blob_references.map do |sha, path| | ||||||
|             find_by_rugged(repository, sha, path, limit: limit) |             find_by_rugged(repository, sha, path, limit: blob_size_limit) | ||||||
|           end |           end | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -181,10 +181,10 @@ describe Gitlab::Git::Blob, seed_helper: true do | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     context 'limiting' do |     context 'limiting' do | ||||||
|       subject { described_class.batch(repository, blob_references, limit: limit) } |       subject { described_class.batch(repository, blob_references, blob_size_limit: blob_size_limit) } | ||||||
| 
 | 
 | ||||||
|       context 'default' do |       context 'default' do | ||||||
|         let(:limit) { nil } |         let(:blob_size_limit) { nil } | ||||||
| 
 | 
 | ||||||
|         it 'limits to MAX_DATA_DISPLAY_SIZE' do |         it 'limits to MAX_DATA_DISPLAY_SIZE' do | ||||||
|           stub_const('Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE', 100) |           stub_const('Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE', 100) | ||||||
|  | @ -194,19 +194,19 @@ describe Gitlab::Git::Blob, seed_helper: true do | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       context 'positive' do |       context 'positive' do | ||||||
|         let(:limit) { 10 } |         let(:blob_size_limit) { 10 } | ||||||
| 
 | 
 | ||||||
|         it { expect(subject.first.data.size).to eq(10) } |         it { expect(subject.first.data.size).to eq(10) } | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       context 'zero' do |       context 'zero' do | ||||||
|         let(:limit) { 0 } |         let(:blob_size_limit) { 0 } | ||||||
| 
 | 
 | ||||||
|         it { expect(subject.first.data).to eq('') } |         it { expect(subject.first.data).to eq('') } | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       context 'negative' do |       context 'negative' do | ||||||
|         let(:limit) { -1 } |         let(:blob_size_limit) { -1 } | ||||||
| 
 | 
 | ||||||
|         it 'ignores MAX_DATA_DISPLAY_SIZE' do |         it 'ignores MAX_DATA_DISPLAY_SIZE' do | ||||||
|           stub_const('Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE', 100) |           stub_const('Gitlab::Git::Blob::MAX_DATA_DISPLAY_SIZE', 100) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue