summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorjurre <jurrestender+github@gmail.com>2016-12-15 21:48:26 +0100
committerjurre <jurrestender+github@gmail.com>2017-01-19 12:30:34 +0100
commite59623e7388d67433ede87db1dad134f6f176f98 (patch)
treea93e528ba7791c73b4f6907593258d6a3ecec78e /app/models/commit.rb
parentd3f26be6f08cd0656589306eb06991b93d1c5825 (diff)
downloadgitlab-ce-e59623e7388d67433ede87db1dad134f6f176f98.tar.gz
Mark MR as WIP when pushing WIP commits
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 3365f4ffdbf..5d942cb0422 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -326,6 +326,12 @@ class Commit
# no-op but needs to be defined since #persisted? is defined
end
+ WIP_REGEX = /\A\s*(((?i)(\[WIP\]|WIP:|WIP)\s|WIP$))|(fixup!|squash!)\s/.freeze
+
+ def work_in_progress?
+ !!(title =~ WIP_REGEX)
+ end
+
private
def commit_reference(from_project, referable_commit_id, full: false)