From: Junio C Hamano Date: Mon, 19 Dec 2016 22:45:34 +0000 (-0800) Subject: Merge branch 'jk/trailers-placeholder-in-pretty' X-Git-Tag: v2.12.0-rc0~131 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f008159fc2dec7b98e74736751d3e6ad8d9c060f;p=thirdparty%2Fgit.git Merge branch 'jk/trailers-placeholder-in-pretty' In addition to %(subject), %(body), "log --pretty=format:..." learned a new placeholder %(trailers). * jk/trailers-placeholder-in-pretty: ref-filter: add support to display trailers as part of contents pretty: add %(trailers) format for displaying trailers of a commit message --- f008159fc2dec7b98e74736751d3e6ad8d9c060f diff --cc t/t6300-for-each-ref.sh index 039509a9cb,eb4bac0fe4..aea1dfc714 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@@ -554,13 -554,29 +554,38 @@@ test_expect_success 'Verify sort with m test_cmp expected actual ' +test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' ' + test_when_finished "git checkout master" && + git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual && + sed -e "s/^\* / /" actual >expect && + git checkout --orphan HEAD && + git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual && + test_cmp expect actual +' + + cat >trailers < + Signed-off-by: A U Thor + 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.clean && + # git for-each-ref ends with a blank line + cat >expect <<-EOF && + $(cat trailers) + + EOF + test_cmp expect actual.clean + ' + test_done