]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t4205-log-pretty-formats.sh
pretty: add %(trailers) format for displaying trailers of a commit message
[thirdparty/git.git] / t / t4205-log-pretty-formats.sh
index f5435fd250baf7415fb6a205f4497cb5c118de65..21eb8c8587f2b4de01595d91d27c8ec6706d2a00 100755 (executable)
@@ -535,4 +535,30 @@ test_expect_success 'clean log decoration' '
        test_cmp expected actual1
 '
 
+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>
+EOF
+
+test_expect_success 'pretty format %(trailers) shows trailers' '
+       echo "Some contents" >trailerfile &&
+       git add trailerfile &&
+       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
+
+       $(cat trailers)
+       EOF
+       git log --no-walk --pretty="%(trailers)" >actual &&
+       cat >expect <<-EOF &&
+       $(cat trailers)
+
+       EOF
+       test_cmp expect actual
+'
+
 test_done