summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-21 15:13:40 +0200
committerDouwe Maan <douwe@gitlab.com>2015-04-24 12:29:36 +0200
commit8ed7ac9d443563a62a6aa03a2ec72b9fcb0d2df1 (patch)
treeb787add194486ac4346c2de2874b32db6d37c635 /lib
parent84a1590252c63c710bceaa7a394799cdc5109505 (diff)
downloadgitlab-ce-8ed7ac9d443563a62a6aa03a2ec72b9fcb0d2df1.tar.gz
Use project.commit convenience method.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/commits.rb8
-rw-r--r--lib/api/files.rb2
-rw-r--r--lib/api/repositories.rb2
-rw-r--r--lib/gitlab/identifier.rb2
-rw-r--r--lib/gitlab/markdown/commit_range_reference_filter.rb2
-rw-r--r--lib/gitlab/markdown/commit_reference_filter.rb2
-rw-r--r--lib/gitlab/note_data_builder.rb2
7 files changed, 10 insertions, 10 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)
diff --git a/lib/gitlab/identifier.rb b/lib/gitlab/identifier.rb
index 6e4de197eeb..3e5d728f3bc 100644
--- a/lib/gitlab/identifier.rb
+++ b/lib/gitlab/identifier.rb
@@ -5,7 +5,7 @@ module Gitlab
def identify(identifier, project, newrev)
if identifier.blank?
# Local push from gitlab
- email = project.repository.commit(newrev).author_email rescue nil
+ email = project.commit(newrev).author_email rescue nil
User.find_by(email: email) if email
elsif identifier =~ /\Auser-\d+\Z/
diff --git a/lib/gitlab/markdown/commit_range_reference_filter.rb b/lib/gitlab/markdown/commit_range_reference_filter.rb
index 1128c1bed7a..baa97bee9bf 100644
--- a/lib/gitlab/markdown/commit_range_reference_filter.rb
+++ b/lib/gitlab/markdown/commit_range_reference_filter.rb
@@ -84,7 +84,7 @@ module Gitlab
def commit(id)
unless @commit_map[id]
- @commit_map[id] = project.repository.commit(id)
+ @commit_map[id] = project.commit(id)
end
@commit_map[id]
diff --git a/lib/gitlab/markdown/commit_reference_filter.rb b/lib/gitlab/markdown/commit_reference_filter.rb
index 745de6402cf..66598127f6e 100644
--- a/lib/gitlab/markdown/commit_reference_filter.rb
+++ b/lib/gitlab/markdown/commit_reference_filter.rb
@@ -66,7 +66,7 @@ module Gitlab
def commit_from_ref(project, commit_ref)
if project && project.valid_repo?
- project.repository.commit(commit_ref)
+ project.commit(commit_ref)
end
end
diff --git a/lib/gitlab/note_data_builder.rb b/lib/gitlab/note_data_builder.rb
index 644dec45dca..0f2abd1b49c 100644
--- a/lib/gitlab/note_data_builder.rb
+++ b/lib/gitlab/note_data_builder.rb
@@ -69,7 +69,7 @@ module Gitlab
def build_data_for_commit(project, user, note)
# commit_id is the SHA hash
- commit = project.repository.commit(note.commit_id)
+ commit = project.commit(note.commit_id)
commit.hook_attrs(project)
end
end