sha1_file: restore OBJECT_INFO_QUICK functionality
[gitweb.git] / t / t4205-log-pretty-formats.sh
index 18aa1b5889749e706cba70c2a4f2633bcc9c9eb4..591f35daaf5825cfdcf8e7fccf4f52462bbf8f78 100755 (executable)
@@ -539,25 +539,62 @@ 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>
+Signed-off-by: A U Thor
+  <author@example.com>
 EOF
 
-test_expect_success 'pretty format %(trailers) shows trailers' '
+unfold () {
+       perl -0pe 's/\n\s+/ /g'
+}
+
+test_expect_success 'set up trailer tests' '
        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
-       message and display the trailers using %bT
+       message and display the trailers using %(trailers).
 
        $(cat trailers)
        EOF
+'
+
+test_expect_success 'pretty format %(trailers) shows trailers' '
        git log --no-walk --pretty="%(trailers)" >actual &&
-       cat >expect <<-EOF &&
-       $(cat trailers)
+       {
+               cat trailers &&
+               echo
+       } >expect &&
+       test_cmp expect actual
+'
 
-       EOF
+test_expect_success '%(trailers:only) shows only "key: value" trailers' '
+       git log --no-walk --pretty="%(trailers:only)" >actual &&
+       {
+               grep -v patch.description <trailers &&
+               echo
+       } >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success '%(trailers:unfold) unfolds trailers' '
+       git log --no-walk --pretty="%(trailers:unfold)" >actual &&
+       {
+               unfold <trailers &&
+               echo
+       } >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success ':only and :unfold work together' '
+       git log --no-walk --pretty="%(trailers:only,unfold)" >actual &&
+       git log --no-walk --pretty="%(trailers:unfold,only)" >reverse &&
+       test_cmp actual reverse &&
+       {
+               grep -v patch.description <trailers | unfold &&
+               echo
+       } >expect &&
        test_cmp expect actual
 '