summaryrefslogtreecommitdiff
path: root/app/models
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 /app/models
parent84a1590252c63c710bceaa7a394799cdc5109505 (diff)
downloadgitlab-ce-8ed7ac9d443563a62a6aa03a2ec72b9fcb0d2df1.tar.gz
Use project.commit convenience method.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/note.rb4
-rw-r--r--app/models/project.rb2
-rw-r--r--app/models/protected_branch.rb2
3 files changed, 4 insertions, 4 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index e3c571a1574..99e86ac0250 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -290,7 +290,7 @@ class Note < ActiveRecord::Base
# +mentioner+.
def noteable_project_id(noteable, mentioning_project)
if noteable.is_a?(Commit)
- if mentioning_project.repository.commit(noteable.id)
+ if mentioning_project.commit(noteable.id)
# The noteable commit belongs to the mentioner's project
mentioning_project.id
else
@@ -512,7 +512,7 @@ class Note < ActiveRecord::Base
# override to return commits, which are not active record
def noteable
if for_commit?
- project.repository.commit(commit_id)
+ project.commit(commit_id)
else
super
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 4c1404ee9f8..293ee04f228 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -257,7 +257,7 @@ class Project < ActiveRecord::Base
@repository ||= Repository.new(path_with_namespace, nil, self)
end
- def commit(id)
+ def commit(id = 'HEAD')
repository.commit(id)
end
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index 97207ba1272..8ebd790a89e 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -18,6 +18,6 @@ class ProtectedBranch < ActiveRecord::Base
validates :project, presence: true
def commit
- project.repository.commit(self.name)
+ project.commit(self.name)
end
end