t/t7004-tag: Add --format specifier tests
tag -v now supports --format specifiers to inspect the contents of a tag upon verification. Add two tests to ensure this behavior is respected in future changes. Signed-off-by: Santiago Torres <santiago@nyu.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Santiago Torres committed
Jan 17, 2017 at 18:37 UTC
4fea72f4f76addb6b49ca4f5b97f66a6bda46985
1 file changed
+16
t/t7004-tag.sh
+16
@@ -847,6 +847,22 @@ test_expect_success GPG 'verifying a forged tag should fail' '
847
test_must_fail git tag -v forged-tag
848
'
849
850
+test_expect_success 'verifying a proper tag with --format pass and format accordingly' '
851
+ cat >expect <<-\EOF
852
+ tagname : signed-tag
853
+ EOF &&
854
+ git tag -v --format="tagname : %(tag)" "signed-tag" >actual &&
855
+ test_cmp expect actual
856
+'
857
+
858
+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
859
+ cat >expect <<-\EOF
860
+ tagname : forged-tag
861
+ EOF &&
862
+ test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag" >actual &&
863
+ test_cmp expect actual
864
+'
865
+
866
# blank and empty messages for signed tags:
867
868
get_tag_header empty-signed-tag $commit commit $time >expect