. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh
-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 &&
test_commit two &&
test_commit four &&
git tag -m "An annotated tag" annotated-tag &&
git tag -m "Annonated doubly" doubly-annotated-tag annotated-tag &&
+
+ # Note that these "signed" tags might not actually be signed.
+ # Tests which care about the distinction should be marked
+ # with the GPG prereq.
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
+ sign=-s
+ else
+ sign=
fi &&
+ git tag $sign -m "A signed tag" signed-tag &&
+ git tag $sign -m "Signed doubly" doubly-signed-tag signed-tag &&
+
git checkout master &&
git update-ref refs/odd/spot master
'
'
test_expect_success 'check signed tags with --points-at' '
- test_prepare_expect <<-\EOF | sed -e "s/Z$//" >expect &&
+ sed -e "s/Z$//" >expect <<-\EOF &&
refs/heads/side Z
refs/tags/annotated-tag four
refs/tags/four Z
'
test_expect_success 'filtering with --no-merged' '
- test_prepare_expect >expect <<-\EOF &&
+ cat >expect <<-\EOF &&
refs/heads/side
refs/tags/annotated-tag
refs/tags/doubly-annotated-tag
'
test_expect_success 'filtering with --contains' '
- test_prepare_expect >expect <<-\EOF &&
+ cat >expect <<-\EOF &&
refs/heads/master
refs/heads/side
refs/odd/spot
'
test_expect_success 'left alignment is default' '
- test_prepare_expect >expect <<-\EOF &&
+ cat >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
'
test_expect_success 'middle alignment' '
- test_prepare_expect >expect <<-\EOF &&
+ cat >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
'
test_expect_success 'right alignment' '
- test_prepare_expect >expect <<-\EOF &&
+ cat >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
test_cmp expect actual
'
-test_prepare_expect >expect <<-\EOF
+cat >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
# Individual atoms inside %(align:...) and %(end) must not be quoted.
test_expect_success 'alignment with format quote' "
- test_prepare_expect >expect <<-\EOF &&
+ cat >expect <<-\EOF &&
|' '\''master| A U Thor'\'' '|
|' '\''side| A U Thor'\'' '|
|' '\''odd/spot| A U Thor'\'' '|
"
test_expect_success 'nested alignment with quote formatting' "
- test_prepare_expect >expect <<-\EOF &&
+ cat >expect <<-\EOF &&
|' master '|
|' side '|
|' odd/spot '|
"
test_expect_success 'check `%(contents:lines=1)`' '
- test_prepare_expect >expect <<-\EOF &&
+ cat >expect <<-\EOF &&
master |three
side |four
odd/spot |three
'
test_expect_success 'check `%(contents:lines=0)`' '
- test_prepare_expect >expect <<-\EOF &&
+ cat >expect <<-\EOF &&
master |
side |
odd/spot |
'
test_expect_success 'check `%(contents:lines=99999)`' '
- test_prepare_expect >expect <<-\EOF &&
+ cat >expect <<-\EOF &&
master |three
side |four
odd/spot |three