diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-02-02 15:02:17 +0000 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-02-02 15:02:17 +0000 |
commit | 53726415388352eb5a71854054cf065377368538 (patch) | |
tree | 047472310ccd89fb43a84101a6441917c461ebf1 /lib/api/files.rb | |
parent | 6cffcb05882b0d3c4a02f9acf21806e25ea09ec3 (diff) | |
parent | d3affe8bca5f5944c6819be1261cc4da7a2c9420 (diff) | |
download | gitlab-ce-53726415388352eb5a71854054cf065377368538.tar.gz |
Merge branch 'lazy-blobs' into 'master'
Lazy Git blobs
To prevent madness like loading a 100MB file into Ruby's memory just
to decide whether it is binary or text.
See merge request !2663
Diffstat (limited to 'lib/api/files.rb')
-rw-r--r-- | lib/api/files.rb | 6 |
1 files changed, 4 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' |