Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-27 08:55:04 +0300
committerJunio C Hamano <gitster@pobox.com>2017-08-27 08:55:04 +0300
commit06cf4f2d87d670f6d49c208fa41933941205da90 (patch)
tree6f140af0079107fb72d9d986b7eb0ad447edc1dc /t/t7513-interpret-trailers.sh
parentbfd91b41341cb922aa1ba6e7c01ccd5ebb81cf41 (diff)
parent5a0d0c037cc187a6eee6329206b9f6a48746a054 (diff)
Merge branch 'jk/trailers-parse'
"git interpret-trailers" has been taught a "--parse" and a few other options to make it easier for scripts to grab existing trailer lines from a commit log message. * jk/trailers-parse: doc/interpret-trailers: fix "the this" typo pretty: support normalization options for %(trailers) t4205: refactor %(trailers) tests pretty: move trailer formatting to trailer.c interpret-trailers: add --parse convenience option interpret-trailers: add an option to unfold values interpret-trailers: add an option to show only existing trailers interpret-trailers: add an option to show only the trailers trailer: put process_trailers() options into a struct
Diffstat (limited to 't/t7513-interpret-trailers.sh')
-rwxr-xr-xt/t7513-interpret-trailers.sh76
1 files changed, 76 insertions, 0 deletions
diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh
index adbdf54f8d..164719d1c9 100755
--- a/t/t7513-interpret-trailers.sh
+++ b/t/t7513-interpret-trailers.sh
@@ -1341,4 +1341,80 @@ test_expect_success 'with cut line' '
test_cmp expected actual
'
+test_expect_success 'only trailers' '
+ git config trailer.sign.command "echo config-value" &&
+ cat >expected <<-\EOF &&
+ existing: existing-value
+ sign: config-value
+ added: added-value
+ EOF
+ git interpret-trailers \
+ --trailer added:added-value \
+ --only-trailers >actual <<-\EOF &&
+ my subject
+
+ my body
+
+ existing: existing-value
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'only-trailers omits non-trailer in middle of block' '
+ git config trailer.sign.command "echo config-value" &&
+ cat >expected <<-\EOF &&
+ Signed-off-by: nobody <nobody@nowhere>
+ Signed-off-by: somebody <somebody@somewhere>
+ sign: config-value
+ EOF
+ git interpret-trailers --only-trailers >actual <<-\EOF &&
+ subject
+
+ it is important that the trailers below are signed-off-by
+ so that they meet the "25% trailers Git knows about" heuristic
+
+ Signed-off-by: nobody <nobody@nowhere>
+ this is not a trailer
+ Signed-off-by: somebody <somebody@somewhere>
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'only input' '
+ git config trailer.sign.command "echo config-value" &&
+ cat >expected <<-\EOF &&
+ existing: existing-value
+ EOF
+ git interpret-trailers \
+ --only-trailers --only-input >actual <<-\EOF &&
+ my subject
+
+ my body
+
+ existing: existing-value
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'unfold' '
+ cat >expected <<-\EOF &&
+ foo: continued across several lines
+ EOF
+ # pass through tr to make leading and trailing whitespace more obvious
+ tr _ " " <<-\EOF |
+ my subject
+
+ my body
+
+ foo:_
+ __continued
+ ___across
+ ____several
+ _____lines
+ ___
+ EOF
+ git interpret-trailers --only-trailers --only-input --unfold >actual &&
+ test_cmp expected actual
+'
+
test_done