summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-02-01 10:41:52 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-02-01 10:41:52 +0100
commit64c8ee47c96d9245081abdf1b9d4ec39cdfc5883 (patch)
treee5eebf2bfef186c7caa6d9b91fae18798657bfaf /app/models
parent481644ca7c9f763d4646ad557cc3bcf8f4f71816 (diff)
downloadgitlab-ce-64c8ee47c96d9245081abdf1b9d4ec39cdfc5883.tar.gz
WIP lazy blobs
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/commit.rb6
-rw-r--r--app/models/tree.rb2
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index d2a29236942..96786ac4573 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -205,7 +205,11 @@ module Ci
end
def ci_yaml_file
- @ci_yaml_file ||= project.repository.blob_at(sha, '.gitlab-ci.yml').data
+ return @ci_yaml_file if defined?(@ci_yaml_file)
+
+ blob = project.repository.blob_at(sha, '.gitlab-ci.yml')
+ blob.load_all_data!(project.repository)
+ @ci_yaml_file = blob.data
rescue
nil
end
diff --git a/app/models/tree.rb b/app/models/tree.rb
index e0e04d8859f..ecee54c3e0a 100644
--- a/app/models/tree.rb
+++ b/app/models/tree.rb
@@ -31,6 +31,8 @@ class Tree
git_repo = repository.raw_repository
@readme = Gitlab::Git::Blob.find(git_repo, sha, readme_path)
+ @readme.load_all_data!(git_repo)
+ @readme
end
def trees