diff --git a/app/workers/process_commit_worker.rb b/app/workers/process_commit_worker.rb index a6330a6c51f..5b25d980bdb 100644 --- a/app/workers/process_commit_worker.rb +++ b/app/workers/process_commit_worker.rb @@ -25,14 +25,14 @@ class ProcessCommitWorker commit = build_commit(project, commit_hash) author = commit.author || user - # this is a GitLab generated commit message, ignore it. - return if commit.merged_merge_request?(user) - process_commit_message(project, commit, user, author, default) update_issue_metrics(commit, author) end def process_commit_message(project, commit, user, author, default = false) + # this is a GitLab generated commit message, ignore it. + return if commit.merged_merge_request?(user) + closed_issues = default ? commit.closes_issues(user) : [] close_issues(project, user, author, commit, closed_issues) if closed_issues.any? diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index 28a8a79e36e..ea59978c58a 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -473,7 +473,8 @@ module Gitlab def parent_ids=(shas) @parent_ids = case shas - when String then JSON.parse(shas) + when String + JSON.parse(shas) else shas end diff --git a/spec/workers/process_commit_worker_spec.rb b/spec/workers/process_commit_worker_spec.rb index ca560fa63e2..76ef57b6b1e 100644 --- a/spec/workers/process_commit_worker_spec.rb +++ b/spec/workers/process_commit_worker_spec.rb @@ -39,7 +39,7 @@ describe ProcessCommitWorker do project.repository.commit(sha) end - it 'does not process the commit' do + it 'it does not close any issues from the commit message' do expect(worker).not_to receive(:close_issues) worker.perform(project.id, user.id, commit.to_hash)