diff options
-rwxr-xr-x | t/lib-gpg.sh | 5 | ||||
-rwxr-xr-x | t/t6302-for-each-ref-filter.sh | 95 |
2 files changed, 65 insertions, 35 deletions
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh index db2ef22e8f..ec2aa8f687 100755 --- a/t/lib-gpg.sh +++ b/t/lib-gpg.sh @@ -1,9 +1,8 @@ #!/bin/sh gpg_version=$(gpg --version 2>&1) -if test $? = 127; then - say "You do not seem to have gpg installed" -else +if test $? != 127 +then # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19 # the gpg version 1.0.6 didn't parse trust packets correctly, so for # that version, creation of signed tags using the generated key fails. diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh index bcf472bf51..70afb44271 100755 --- a/t/t6302-for-each-ref-filter.sh +++ b/t/t6302-for-each-ref-filter.sh @@ -5,11 +5,14 @@ test_description='test for-each-refs usage of ref-filter APIs' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-gpg.sh -if ! test_have_prereq GPG -then - skip_all="skipping for-each-ref tests, GPG not available" - test_done -fi +test_prepare_expect () { + if test_have_prereq GPG + then + cat + else + sed '/signed/d' + fi +} test_expect_success 'setup some history and refs' ' test_commit one && @@ -17,8 +20,13 @@ test_expect_success 'setup some history and refs' ' test_commit three && git checkout -b side && test_commit four && - git tag -s -m "A signed tag message" signed-tag && - git tag -s -m "Annonated doubly" double-tag signed-tag && + git tag -m "An annotated tag" annotated-tag && + git tag -m "Annonated doubly" doubly-annotated-tag annotated-tag && + if test_have_prereq GPG + then + git tag -s -m "A signed tag" signed-tag && + git tag -s -m "Signed doubly" doubly-signed-tag signed-tag + fi && git checkout master && git update-ref refs/odd/spot master ' @@ -34,8 +42,9 @@ test_expect_success 'filtering with --points-at' ' ' test_expect_success 'check signed tags with --points-at' ' - sed -e "s/Z$//" >expect <<-\EOF && + test_prepare_expect <<-\EOF | sed -e "s/Z$//" >expect && refs/heads/side Z + refs/tags/annotated-tag four refs/tags/four Z refs/tags/signed-tag four EOF @@ -56,9 +65,11 @@ test_expect_success 'filtering with --merged' ' ' test_expect_success 'filtering with --no-merged' ' - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && refs/heads/side - refs/tags/double-tag + refs/tags/annotated-tag + refs/tags/doubly-annotated-tag + refs/tags/doubly-signed-tag refs/tags/four refs/tags/signed-tag EOF @@ -67,11 +78,13 @@ test_expect_success 'filtering with --no-merged' ' ' test_expect_success 'filtering with --contains' ' - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && refs/heads/master refs/heads/side refs/odd/spot - refs/tags/double-tag + refs/tags/annotated-tag + refs/tags/doubly-annotated-tag + refs/tags/doubly-signed-tag refs/tags/four refs/tags/signed-tag refs/tags/three @@ -86,11 +99,13 @@ test_expect_success '%(color) must fail' ' ' test_expect_success 'left alignment is default' ' - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && refname is refs/heads/master |refs/heads/master refname is refs/heads/side |refs/heads/side refname is refs/odd/spot |refs/odd/spot - refname is refs/tags/double-tag|refs/tags/double-tag + refname is refs/tags/annotated-tag|refs/tags/annotated-tag + refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag + refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag refname is refs/tags/four |refs/tags/four refname is refs/tags/one |refs/tags/one refname is refs/tags/signed-tag|refs/tags/signed-tag @@ -102,11 +117,13 @@ test_expect_success 'left alignment is default' ' ' test_expect_success 'middle alignment' ' - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && | refname is refs/heads/master |refs/heads/master | refname is refs/heads/side |refs/heads/side | refname is refs/odd/spot |refs/odd/spot - |refname is refs/tags/double-tag|refs/tags/double-tag + |refname is refs/tags/annotated-tag|refs/tags/annotated-tag + |refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag + |refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag | refname is refs/tags/four |refs/tags/four | refname is refs/tags/one |refs/tags/one |refname is refs/tags/signed-tag|refs/tags/signed-tag @@ -118,11 +135,13 @@ test_expect_success 'middle alignment' ' ' test_expect_success 'right alignment' ' - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && | refname is refs/heads/master|refs/heads/master | refname is refs/heads/side|refs/heads/side | refname is refs/odd/spot|refs/odd/spot - |refname is refs/tags/double-tag|refs/tags/double-tag + |refname is refs/tags/annotated-tag|refs/tags/annotated-tag + |refname is refs/tags/doubly-annotated-tag|refs/tags/doubly-annotated-tag + |refname is refs/tags/doubly-signed-tag|refs/tags/doubly-signed-tag | refname is refs/tags/four|refs/tags/four | refname is refs/tags/one|refs/tags/one |refname is refs/tags/signed-tag|refs/tags/signed-tag @@ -133,11 +152,13 @@ test_expect_success 'right alignment' ' test_cmp expect actual ' -cat >expect <<-\EOF +test_prepare_expect >expect <<-\EOF | refname is refs/heads/master |refs/heads/master | refname is refs/heads/side |refs/heads/side | refname is refs/odd/spot |refs/odd/spot -| refname is refs/tags/double-tag |refs/tags/double-tag +| refname is refs/tags/annotated-tag |refs/tags/annotated-tag +|refname is refs/tags/doubly-annotated-tag |refs/tags/doubly-annotated-tag +| refname is refs/tags/doubly-signed-tag |refs/tags/doubly-signed-tag | refname is refs/tags/four |refs/tags/four | refname is refs/tags/one |refs/tags/one | refname is refs/tags/signed-tag |refs/tags/signed-tag @@ -178,11 +199,13 @@ EOF # Individual atoms inside %(align:...) and %(end) must not be quoted. test_expect_success 'alignment with format quote' " - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && |' '\''master| A U Thor'\'' '| |' '\''side| A U Thor'\'' '| |' '\''odd/spot| A U Thor'\'' '| - |' '\''double-tag| '\'' '| + |' '\''annotated-tag| '\'' '| + |' '\''doubly-annotated-tag| '\'' '| + |' '\''doubly-signed-tag| '\'' '| |' '\''four| A U Thor'\'' '| |' '\''one| A U Thor'\'' '| |' '\''signed-tag| '\'' '| @@ -194,11 +217,13 @@ test_expect_success 'alignment with format quote' " " test_expect_success 'nested alignment with quote formatting' " - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && |' master '| |' side '| |' odd/spot '| - |' double-tag '| + |' annotated-tag '| + |'doubly-annotated-tag '| + |'doubly-signed-tag '| |' four '| |' one '| |' signed-tag '| @@ -210,14 +235,16 @@ test_expect_success 'nested alignment with quote formatting' " " test_expect_success 'check `%(contents:lines=1)`' ' - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && master |three side |four odd/spot |three - double-tag |Annonated doubly + annotated-tag |An annotated tag + doubly-annotated-tag |Annonated doubly + doubly-signed-tag |Signed doubly four |four one |one - signed-tag |A signed tag message + signed-tag |A signed tag three |three two |two EOF @@ -226,11 +253,13 @@ test_expect_success 'check `%(contents:lines=1)`' ' ' test_expect_success 'check `%(contents:lines=0)`' ' - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && master | side | odd/spot | - double-tag | + annotated-tag | + doubly-annotated-tag | + doubly-signed-tag | four | one | signed-tag | @@ -242,14 +271,16 @@ test_expect_success 'check `%(contents:lines=0)`' ' ' test_expect_success 'check `%(contents:lines=99999)`' ' - cat >expect <<-\EOF && + test_prepare_expect >expect <<-\EOF && master |three side |four odd/spot |three - double-tag |Annonated doubly + annotated-tag |An annotated tag + doubly-annotated-tag |Annonated doubly + doubly-signed-tag |Signed doubly four |four one |one - signed-tag |A signed tag message + signed-tag |A signed tag three |three two |two EOF |