diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 18:08:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 18:08:52 +0300 |
commit | 0ab47b994caa80c5587f33dc818626b66cfdafe2 (patch) | |
tree | 5ef3976d2f84e3368903a67ba2dbd87a74b9a43c /app/models/commit.rb | |
parent | 1308dc5eb484ab0f8064989fc551ebdb4b1a7976 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 46222bbc4cd..d8a3bbfeeb2 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -244,6 +244,8 @@ class Commit # Discover issues should be closed when this commit is pushed to a project's # default branch. def closes_issues(current_user = self.committer) + return unless repository.repo_type.project? + Gitlab::ClosingIssueExtractor.new(project, current_user).closed_by_message(safe_message) end @@ -297,7 +299,11 @@ class Commit end def merge_requests - @merge_requests ||= project&.merge_requests&.by_commit_sha(sha) + strong_memoize(:merge_requests) do + next MergeRequest.none unless repository.repo_type.project? && project + + project.merge_requests.by_commit_sha(sha) + end end def method_missing(method, *args, &block) @@ -507,7 +513,7 @@ class Commit end def commit_reference(from, referable_commit_id, full: false) - base = project&.to_reference_base(from, full: full) + base = container.to_reference_base(from, full: full) if base.present? "#{base}#{self.class.reference_prefix}#{referable_commit_id}" |