summaryrefslogtreecommitdiff
path: root/t/t6300-for-each-ref.sh
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2016-11-19 00:58:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-11 21:58:41 (GMT)
commitb1d31c8954f9c21b275f4fb7d872414b564c201c (patch)
tree58a8f8d36a5f9331a0e393e086f447ad65047af7 /t/t6300-for-each-ref.sh
parentd9f31fbfe98e0e363a3c69aaf6badecc746afe6b (diff)
downloadgit-b1d31c8954f9c21b275f4fb7d872414b564c201c.zip
git-b1d31c8954f9c21b275f4fb7d872414b564c201c.tar.gz
git-b1d31c8954f9c21b275f4fb7d872414b564c201c.tar.bz2
ref-filter: add support to display trailers as part of contents
Add %(trailers) and %(contents:trailers) to display the trailers as interpreted by trailer_info_get. Update documentation and add a test for the new feature. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6300-for-each-ref.sh')
-rwxr-xr-xt/t6300-for-each-ref.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 19a2823..eb4bac0 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -553,4 +553,30 @@ test_expect_success 'Verify sort with multiple keys' '
refs/tags/bogo refs/tags/master > actual &&
test_cmp expected actual
'
+
+cat >trailers <<EOF
+Reviewed-by: A U Thor <author@example.com>
+Signed-off-by: A U Thor <author@example.com>
+EOF
+
+test_expect_success 'basic atom: head contents:trailers' '
+ echo "Some contents" > two &&
+ git add two &&
+ git commit -F - <<-EOF &&
+ trailers: this commit message has trailers
+
+ Some message contents
+
+ $(cat trailers)
+ EOF
+ git for-each-ref --format="%(contents:trailers)" refs/heads/master >actual &&
+ sanitize_pgp <actual >actual.clean &&
+ # git for-each-ref ends with a blank line
+ cat >expect <<-EOF &&
+ $(cat trailers)
+
+ EOF
+ test_cmp expect actual.clean
+'
+
test_done