diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-02-04 09:49:54 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-02-04 09:49:54 +0000 |
commit | a1fa973123796ce27559063a644f093539107a7f (patch) | |
tree | 7b73753a3f1642880cd05c3b35d1b7a31028825e | |
parent | 8d948744461619ac3561be93d545d72343efa0cd (diff) | |
parent | f0c2f7481febf1e1149cb3dba87780c462759d14 (diff) | |
download | gitlab-ce-a1fa973123796ce27559063a644f093539107a7f.tar.gz |
Merge branch 'wipMergeSpacing' into 'master'
No space required after WIP identifier
Fixes #2426
Currently, the WIP: (or any other variation) prefix of a merge request title must include a trailing space for it to be recognized as a work in progress and prevent merging.
To resolve this, I added an or pattern to the regexp to look for any one of the three possible delimiters ':', ']', or ' '. This way the trailing space isn't required but it still won't mark any titles beginning with wip as work in progress (e.g. "Wipwap").
See merge request !1876
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/merge_request.rb | 2 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 5 |
3 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index 481a0f8d243..fc123b22b11 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -180,6 +180,7 @@ v 8.3.0 - Handle and report SSL errors in Web hook test (Stan Hu) - Bump Redis requirement to 2.8 for Sidekiq 4 (Stan Hu) - Fix: Assignee selector is empty when 'Unassigned' is selected (Jose Corcuera) + - WIP identifier on merge requests no longer requires trailing space - Add rake tasks for git repository maintainance (Zeger-Jan van de Weg) - Fix 500 error when update group member permission - Fix: As an admin, cannot add oneself as a member to a group/project diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 89b6c49b362..2594a7e3578 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -258,7 +258,7 @@ class MergeRequest < ActiveRecord::Base end def work_in_progress? - !!(title =~ /\A\[?WIP\]?:? /i) + !!(title =~ /\A\[?WIP(\]|:| )/i) end def mergeable? diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 46f2f20b986..cd1953bfc5e 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -188,6 +188,11 @@ describe MergeRequest, models: true do expect(subject).to be_work_in_progress end + it "detects the '[WIP]' prefix" do + subject.title = "[WIP]#{subject.title}" + expect(subject).to be_work_in_progress + end + it "doesn't detect WIP for words starting with WIP" do subject.title = "Wipwap #{subject.title}" expect(subject).not_to be_work_in_progress |