From 3d50725c2b0617f9a4f41b0d04b8b1c292b71055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Tue, 29 May 2018 12:23:39 +0200 Subject: [PATCH] Add test for stripping `Signed-off-by` line --- commands/pull_request.go | 2 +- features/pull_request.feature | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/commands/pull_request.go b/commands/pull_request.go index f2edc989..c67e7bf3 100644 --- a/commands/pull_request.go +++ b/commands/pull_request.go @@ -253,7 +253,7 @@ of text is the title and the rest is the description.`, fullBase, fullHead)) message, err = git.Show(commits[0]) utils.Check(err) - re := regexp.MustCompile(`(?m)\n^Signed-off-by:\s.*$`) + re := regexp.MustCompile(`\nSigned-off-by:\s.*$`) message = re.ReplaceAllString(message, "") } else if len(commits) > 1 { commitLogs, err = git.Log(baseTracking, headForMessage) diff --git a/features/pull_request.feature b/features/pull_request.feature index d1589a7d..2c836204 100644 --- a/features/pull_request.feature +++ b/features/pull_request.feature @@ -81,14 +81,20 @@ Feature: hub pull-request post('/repos/mislav/coral/pulls') { halt 400 if request.content_charset != 'utf-8' assert :title => 'This is somewhat of a longish title that does not get wrapped & references #1234', - :body => nil + :body => 'Hello' status 201 json :html_url => "the://url" } """ Given I am on the "master" branch pushed to "origin/master" When I successfully run `git checkout --quiet -b topic` - Given I make a commit with message "This is somewhat of a longish title that does not get wrapped & references #1234" + Given I make a commit with message: + """ + This is somewhat of a longish title that does not get wrapped & references #1234 + + Hello + Signed-off-by: NAME + """ And the "topic" branch is pushed to "origin/topic" When I successfully run `hub pull-request` Then the output should contain exactly "the://url\n" -- GitLab