summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-01-31 13:14:58 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-31 13:14:58 -0800
commit237bdd9ddbe52eb651787af1929d8832ce37c322 (patch)
treeb01cda85ff37584fe07b2f32065b88e2d5dbe159 /t
parentMerge branch 'js/mingw-isatty' (diff)
parentt/t7004-tag: Add --format specifier tests (diff)
downloadtgif-237bdd9ddbe52eb651787af1929d8832ce37c322.tar.xz
Merge branch 'st/verify-tag'
"git tag" and "git verify-tag" learned to put GPG verification status in their "--format=<placeholders>" output format. * st/verify-tag: t/t7004-tag: Add --format specifier tests t/t7030-verify-tag: Add --format specifier tests builtin/tag: add --format argument for tag -v builtin/verify-tag: add --format to verify-tag ref-filter: add function to print single ref_array_item gpg-interface, tag: add GPG_VERIFY_OMIT_STATUS flag
Diffstat (limited to 't')
-rwxr-xr-xt/t7004-tag.sh16
-rwxr-xr-xt/t7030-verify-tag.sh16
2 files changed, 32 insertions, 0 deletions
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 1cfa8a21d2..b676b90c7d 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -871,6 +871,22 @@ test_expect_success GPG 'verifying a forged tag should fail' '
test_must_fail git tag -v forged-tag
'
+test_expect_success 'verifying a proper tag with --format pass and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : signed-tag
+ EOF &&
+ git tag -v --format="tagname : %(tag)" "signed-tag" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : forged-tag
+ EOF &&
+ test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag" >actual &&
+ test_cmp expect actual
+'
+
# blank and empty messages for signed tags:
get_tag_header empty-signed-tag $commit commit $time >expect
diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
index 07079a41c4..d62ccbb98e 100755
--- a/t/t7030-verify-tag.sh
+++ b/t/t7030-verify-tag.sh
@@ -125,4 +125,20 @@ test_expect_success GPG 'verify multiple tags' '
test_cmp expect.stderr actual.stderr
'
+test_expect_success 'verifying tag with --format' '
+ cat >expect <<-\EOF
+ tagname : fourth-signed
+ EOF &&
+ git verify-tag --format="tagname : %(tag)" "fourth-signed" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : 7th forged-signed
+ EOF &&
+ test_must_fail git verify-tag --format="tagname : %(tag)" $(cat forged1.tag) >actual-forged &&
+ test_cmp expect actual-forged
+'
+
test_done