diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-21 15:13:40 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-24 12:29:36 +0200 |
commit | 8ed7ac9d443563a62a6aa03a2ec72b9fcb0d2df1 (patch) | |
tree | b787add194486ac4346c2de2874b32db6d37c635 /lib/api | |
parent | 84a1590252c63c710bceaa7a394799cdc5109505 (diff) | |
download | gitlab-ce-8ed7ac9d443563a62a6aa03a2ec72b9fcb0d2df1.tar.gz |
Use project.commit convenience method.
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/commits.rb | 8 | ||||
-rw-r--r-- | lib/api/files.rb | 2 | ||||
-rw-r--r-- | lib/api/repositories.rb | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 0de4e720ffe..23270b1c0f4 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -32,7 +32,7 @@ module API # GET /projects/:id/repository/commits/:sha get ":id/repository/commits/:sha" do sha = params[:sha] - commit = user_project.repository.commit(sha) + commit = user_project.commit(sha) not_found! "Commit" unless commit present commit, with: Entities::RepoCommitDetail end @@ -46,7 +46,7 @@ module API # GET /projects/:id/repository/commits/:sha/diff get ":id/repository/commits/:sha/diff" do sha = params[:sha] - commit = user_project.repository.commit(sha) + commit = user_project.commit(sha) not_found! "Commit" unless commit commit.diffs end @@ -60,7 +60,7 @@ module API # GET /projects/:id/repository/commits/:sha/comments get ':id/repository/commits/:sha/comments' do sha = params[:sha] - commit = user_project.repository.commit(sha) + commit = user_project.commit(sha) not_found! 'Commit' unless commit notes = Note.where(commit_id: commit.id) present paginate(notes), with: Entities::CommitNote @@ -81,7 +81,7 @@ module API required_attributes! [:note] sha = params[:sha] - commit = user_project.repository.commit(sha) + commit = user_project.commit(sha) not_found! 'Commit' unless commit opts = { note: params[:note], diff --git a/lib/api/files.rb b/lib/api/files.rb index 3176ef0e256..e0ea6d7dd1d 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -34,7 +34,7 @@ module API ref = attrs.delete(:ref) file_path = attrs.delete(:file_path) - commit = user_project.repository.commit(ref) + commit = user_project.commit(ref) not_found! 'Commit' unless commit blob = user_project.repository.blob_at(commit.sha, file_path) diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 1fbf3dca3c6..2d96c9666d2 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -62,7 +62,7 @@ module API ref = params[:ref_name] || user_project.try(:default_branch) || 'master' path = params[:path] || nil - commit = user_project.repository.commit(ref) + commit = user_project.commit(ref) not_found!('Tree') unless commit tree = user_project.repository.tree(commit.id, path) |