diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/files.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/highlight.rb | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/api/files.rb b/lib/api/files.rb index 8ad2c1883c7..c1d86f313b0 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -58,9 +58,11 @@ module API commit = user_project.commit(ref) not_found! 'Commit' unless commit - blob = user_project.repository.blob_at(commit.sha, file_path) + repo = user_project.repository + blob = repo.blob_at(commit.sha, file_path) if blob + blob.load_all_data!(repo) status(200) { @@ -72,7 +74,7 @@ module API ref: ref, blob_id: blob.id, commit_id: commit.id, - last_commit_id: user_project.repository.last_commit_for_path(commit.sha, file_path).id + last_commit_id: repo.last_commit_for_path(commit.sha, file_path).id } else not_found! 'File' diff --git a/lib/gitlab/highlight.rb b/lib/gitlab/highlight.rb index 4ddb4fea977..cac76442321 100644 --- a/lib/gitlab/highlight.rb +++ b/lib/gitlab/highlight.rb @@ -8,6 +8,7 @@ module Gitlab blob = repository.blob_at(ref, file_name) return [] unless blob + blob.load_all_data!(repository) highlight(file_name, blob.data).lines.map!(&:html_safe) end |