mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-23 19:46:12 +10:00
Merge branch 'fix-zero-sha-lookup' into 'master'
Repository#blob_at should return nil for 00000000... sha Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> See merge request !916
This commit is contained in:
@@ -8,7 +8,7 @@ class Repository
|
||||
@project = project
|
||||
|
||||
if path_with_namespace
|
||||
@raw_repository = Gitlab::Git::Repository.new(path_to_repo)
|
||||
@raw_repository = Gitlab::Git::Repository.new(path_to_repo)
|
||||
@raw_repository.autocrlf = :input
|
||||
end
|
||||
|
||||
@@ -173,7 +173,9 @@ class Repository
|
||||
end
|
||||
|
||||
def blob_at(sha, path)
|
||||
Gitlab::Git::Blob.find(self, sha, path)
|
||||
unless Gitlab::Git.blank_ref?(sha)
|
||||
Gitlab::Git::Blob.find(self, sha, path)
|
||||
end
|
||||
end
|
||||
|
||||
def blob_by_oid(oid)
|
||||
|
||||
@@ -25,4 +25,12 @@ describe Repository do
|
||||
|
||||
it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') }
|
||||
end
|
||||
|
||||
describe :blob_at do
|
||||
context 'blank sha' do
|
||||
subject { repository.blob_at(Gitlab::Git::BLANK_SHA, '.gitignore') }
|
||||
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user