Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-09-01 01:49:47 +0300
committerJunio C Hamano <gitster@pobox.com>2020-09-01 01:49:47 +0300
commite17723842b4fd42215ebf9c7ee5ab0bdfbe5a402 (patch)
tree3b969dd1f4f8c01e841600503d93d893f68f45f9 /t
parent63728e481451b8e218bec4d21ce085471d90fe7a (diff)
parent2c22e102f8cae598061be509344c6fdaf99c7db7 (diff)
Merge branch 'hv/ref-filter-trailers-atom-parsing-fix'
The parser for "git for-each-ref --format=..." was too loose when parsing the "%(trailers...)" atom, and forgot that "trailers" and "trailers:<modifiers>" are the only two allowed forms, which has been corrected. * hv/ref-filter-trailers-atom-parsing-fix: ref-filter: 'contents:trailers' show error if `:` is missing t6300: unify %(trailers) and %(contents:trailers) tests
Diffstat (limited to 't')
-rwxr-xr-xt/t6300-for-each-ref.sh56
1 files changed, 18 insertions, 38 deletions
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index a83579fbdf..58adee7d18 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -776,61 +776,40 @@ test_expect_success 'set up trailers for next test' '
'
test_expect_success '%(trailers:unfold) unfolds trailers' '
- git for-each-ref --format="%(trailers:unfold)" refs/heads/master >actual &&
{
unfold <trailers
echo
} >expect &&
+ git for-each-ref --format="%(trailers:unfold)" refs/heads/master >actual &&
+ test_cmp expect actual &&
+ git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/master >actual &&
test_cmp expect actual
'
test_expect_success '%(trailers:only) shows only "key: value" trailers' '
- git for-each-ref --format="%(trailers:only)" refs/heads/master >actual &&
{
grep -v patch.description <trailers &&
echo
} >expect &&
+ git for-each-ref --format="%(trailers:only)" refs/heads/master >actual &&
+ test_cmp expect actual &&
+ git for-each-ref --format="%(contents:trailers:only)" refs/heads/master >actual &&
test_cmp expect actual
'
test_expect_success '%(trailers:only) and %(trailers:unfold) work together' '
- git for-each-ref --format="%(trailers:only,unfold)" refs/heads/master >actual &&
- git for-each-ref --format="%(trailers:unfold,only)" refs/heads/master >reverse &&
- test_cmp actual reverse &&
{
grep -v patch.description <trailers | unfold &&
echo
} >expect &&
- test_cmp expect actual
-'
-
-test_expect_success '%(contents:trailers:unfold) unfolds trailers' '
- git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/master >actual &&
- {
- unfold <trailers
- echo
- } >expect &&
- test_cmp expect actual
-'
-
-test_expect_success '%(contents:trailers:only) shows only "key: value" trailers' '
- git for-each-ref --format="%(contents:trailers:only)" refs/heads/master >actual &&
- {
- grep -v patch.description <trailers &&
- echo
- } >expect &&
- test_cmp expect actual
-'
-
-test_expect_success '%(contents:trailers:only) and %(contents:trailers:unfold) work together' '
+ git for-each-ref --format="%(trailers:only,unfold)" refs/heads/master >actual &&
+ test_cmp expect actual &&
+ git for-each-ref --format="%(trailers:unfold,only)" refs/heads/master >actual &&
+ test_cmp actual actual &&
git for-each-ref --format="%(contents:trailers:only,unfold)" refs/heads/master >actual &&
- git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/master >reverse &&
- test_cmp actual reverse &&
- {
- grep -v patch.description <trailers | unfold &&
- echo
- } >expect &&
- test_cmp expect actual
+ test_cmp expect actual &&
+ git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/master >actual &&
+ test_cmp actual actual
'
test_expect_success '%(trailers) rejects unknown trailers arguments' '
@@ -839,15 +818,16 @@ test_expect_success '%(trailers) rejects unknown trailers arguments' '
fatal: unknown %(trailers) argument: unsupported
EOF
test_must_fail git for-each-ref --format="%(trailers:unsupported)" 2>actual &&
+ test_i18ncmp expect actual &&
+ test_must_fail git for-each-ref --format="%(contents:trailers:unsupported)" 2>actual &&
test_i18ncmp expect actual
'
-test_expect_success '%(contents:trailers) rejects unknown trailers arguments' '
- # error message cannot be checked under i18n
+test_expect_success 'if arguments, %(contents:trailers) shows error if colon is missing' '
cat >expect <<-EOF &&
- fatal: unknown %(trailers) argument: unsupported
+ fatal: unrecognized %(contents) argument: trailersonly
EOF
- test_must_fail git for-each-ref --format="%(contents:trailers:unsupported)" 2>actual &&
+ test_must_fail git for-each-ref --format="%(contents:trailersonly)" 2>actual &&
test_i18ncmp expect actual
'