Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
t4205: refactor %(trailers) tests
author
Jeff King
<peff@peff.net>
Tue, 15 Aug 2017 10:24:39 +0000
(06:24 -0400)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 15 Aug 2017 18:13:58 +0000
(11:13 -0700)
We currently have one test for %(trailers). In preparation
for more, let's refactor a few bits:
- move the commit creation to its own setup step so it can
be reused by multiple tests
- add a trailer with whitespace continuation (to confirm
that it is left untouched)
- fix the sample text which claims the placeholder is %bT.
This was switched long ago to %(trailers)
- replace one "cat" with an "echo" when generating the
expected output. This saves a process (and sets a better
pattern for future tests to follow).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4205-log-pretty-formats.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
a388b10
)
diff --git
a/t/t4205-log-pretty-formats.sh
b/t/t4205-log-pretty-formats.sh
index 18aa1b5889749e706cba70c2a4f2633bcc9c9eb4..83ea85eb453cb690cea39e16777eecdc7b7304db 100755
(executable)
--- a/
t/t4205-log-pretty-formats.sh
+++ b/
t/t4205-log-pretty-formats.sh
@@
-539,25
+539,29
@@
cat >trailers <<EOF
Signed-off-by: A U Thor <author@example.com>
Acked-by: A U Thor <author@example.com>
[ v2 updated patch description ]
Signed-off-by: A U Thor <author@example.com>
Acked-by: A U Thor <author@example.com>
[ v2 updated patch description ]
-Signed-off-by: A U Thor <author@example.com>
+Signed-off-by: A U Thor
+ <author@example.com>
EOF
EOF
-test_expect_success '
pretty format %(trailers) shows trailer
s' '
+test_expect_success '
set up trailer test
s' '
echo "Some contents" >trailerfile &&
git add trailerfile &&
echo "Some contents" >trailerfile &&
git add trailerfile &&
- git commit -F - <<-EOF
&&
+ git commit -F - <<-EOF
trailers: this commit message has trailers
This commit is a test commit with trailers at the end. We parse this
trailers: this commit message has trailers
This commit is a test commit with trailers at the end. We parse this
- message and display the trailers using %
bT
+ message and display the trailers using %
(trailers).
$(cat trailers)
EOF
$(cat trailers)
EOF
- git log --no-walk --pretty="%(trailers)" >actual &&
- cat >expect <<-EOF &&
- $(cat trailers)
+'
- EOF
+test_expect_success 'pretty format %(trailers) shows trailers' '
+ git log --no-walk --pretty="%(trailers)" >actual &&
+ {
+ cat trailers &&
+ echo
+ } >expect &&
test_cmp expect actual
'
test_cmp expect actual
'