summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-07-01 11:37:22 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-07-01 11:37:22 +0200
commit16b8a1ef04490cff9cdb6d2d367ac4ceab526896 (patch)
tree351eba99b044ad5d50d94affcfabb1060a9a34bf
parent690aafebdb96b01d585fedf6a3ba7be0d8adbf67 (diff)
parent2d85458ac7e5c054b93cf5f3bf228dfcf12fe0a9 (diff)
downloadgitlab-ce-16b8a1ef04490cff9cdb6d2d367ac4ceab526896.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
-rw-r--r--app/models/repository.rb6
-rw-r--r--spec/models/repository_spec.rb8
2 files changed, 12 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index b32e8847bb5..cab3e896159 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -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)
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index f41e5a97ca3..77ceb6c8adc 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -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