Add tests for git tag
These tests check whether git-tag properly sends a comment into the editor, and whether it reuses previous annotation when overwriting an existing tag. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Mike Hommey committed
Nov 4, 2007 at 01:11 UTC
4d8b1dc850bafdf2304a525a768fbfc7aa5361ae
1 file changed
+16
t/t7004-tag.sh
+16
@@ -1004,4 +1004,20 @@ test_expect_failure \
1004
'verify signed tag fails when public key is not present' \
1005
'git-tag -v signed-tag'
1006
1007
+test_expect_success \
1008
+ 'message in editor has initial comment' '
1009
+ GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
1010
+ test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
1011
+'
1012
+
1013
+get_tag_header reuse $commit commit $time >expect
1014
+echo "An annotation to be reused" >> expect
1015
+test_expect_success \
1016
+ 'overwriting an annoted tag should use its previous body' '
1017
+ git tag -a -m "An annotation to be reused" reuse &&
1018
+ GIT_EDITOR=true git tag -f -a reuse &&
1019
+ get_tag_msg reuse >actual &&
1020
+ git diff expect actual
1021
+'
1022
+
1023
test_done