summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicaël Bergeron <mbergeron@gitlab.com>2018-02-16 13:49:07 -0500
committerMicaël Bergeron <mbergeron@gitlab.com>2018-02-16 13:51:19 -0500
commitaf5cd10e00402937310dfe8e4dfa48b0c15b157a (patch)
tree34a52733ab36f4b631d626bccc090c23e04d5286
parentf9492554617d807b35358cb799d26e3422dd4c71 (diff)
downloadgitlab-ce-32564-fix-double-system-closing-notes.tar.gz
# modified: lib/gitlab/git/commit.rb
-rw-r--r--app/workers/process_commit_worker.rb6
-rw-r--r--lib/gitlab/git/commit.rb3
-rw-r--r--spec/workers/process_commit_worker_spec.rb2
3 files changed, 6 insertions, 5 deletions
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)