{"thread":{"id":"38371","subject":"cosmetic bug: \"git show --pretty:format\" produces different output than \"git show --format\"","startedAt":"2015-01-15T13:55:08Z","lastAt":"2015-01-15T19:25:47Z","messageCount":4,"participants":["Francesc Zacarias","Michael J Gruber","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"254744","messageId":"CAEKevnWfFq9gyN8Ga8zXUDwk_+Mk6RK0HVT-+sbejjVPw0U0=w@mail.gmail.com","threadId":"38371","inReplyTo":null,"subject":"cosmetic bug: \"git show --pretty:format\" produces different output than \"git show --format\"","fromName":"Francesc Zacarias","fromEmail":"francesc@spotify.com","sentAt":"2015-01-15T13:55:08Z","receivedAt":"2015-01-15T13:55:08Z","isPatch":false,"sender":{"key":"francesc@spotify.com","avatar":null},"body":"Hi!\n\nI noticed that git produces differing output for\n\"git show --pretty:format show\" and \"git show --format\", even though\nthe man page says that both are equivalent.\n\"git show --format\" always appends an empty line at the end. The only\nway I've found to get rid of that empty line in --format is by adding\n-s option.\n\nSo, \"git show --pretty:format\" and \"git show -s --format\" do produce\nthe same output.\n\nI can reproduce this issue in Ubuntu Trusty (git version 1.9.1) and\nDebian Jessie (git version 2.1.4).\n"},{"id":"254751","messageId":"54B7E98B.6020907@drmicha.warpmail.net","threadId":"38371","inReplyTo":"CAEKevnWfFq9gyN8Ga8zXUDwk_+Mk6RK0HVT-+sbejjVPw0U0=w@mail.gmail.com","subject":"Re: cosmetic bug: \"git show --pretty:format\" produces different output than \"git show --format\"","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-01-15T16:23:39Z","receivedAt":"2015-01-15T16:23:39Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Francesc Zacarias schrieb am 15.01.2015 um 14:55:\n> Hi!\n> \n> I noticed that git produces differing output for\n> \"git show --pretty:format show\" and \"git show --format\", even though\n> the man page says that both are equivalent.\n> \"git show --format\" always appends an empty line at the end. The only\n> way I've found to get rid of that empty line in --format is by adding\n> -s option.\n> \n> So, \"git show --pretty:format\" and \"git show -s --format\" do produce\n> the same output.\n> \n> I can reproduce this issue in Ubuntu Trusty (git version 1.9.1) and\n> Debian Jessie (git version 2.1.4).\n> \n\nThe first part of the man page is a bit sloppy, but refers to the FORMAT\nsection. There, it says that \"--pretty\" is equivalent to\n\"--pretty=tformat:\" which is different from \"--pretty=format:\".\n\nUnfortunately, \"--format\" seems to be parsed as (\"--pretty\" and\ntherefore?) \"--pretty=tformat:\" which I consider a bug.\n\nMichael\n"},{"id":"254755","messageId":"xmqq8uh47xkq.fsf@gitster.dls.corp.google.com","threadId":"38371","inReplyTo":"54B7E98B.6020907@drmicha.warpmail.net","subject":"Re: cosmetic bug: \"git show --pretty:format\" produces different output than \"git show --format\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-01-15T17:39:17Z","receivedAt":"2015-01-15T17:39:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Unfortunately, \"--format\" seems to be parsed as (\"--pretty\" and\n> therefore?) \"--pretty=tformat:\" which I consider a bug.\n\n\"tformat:\" was introduced to fix \"format:, because many people found\nthe latter hard to use, probably because most of the time they\nwanted to use the feature to show one-line-per-commit and a LF after\neach record (\"terminator semantics\" where 't' in \"tformat:\" comes\nfrom) made more sense in that context, compared to a LF between each\nrecord (\"delimiter semantics\").\n\nOf course, \"format:\" that uses the delimiter semantics has its uses;\nafter all, the delimiter semantics is what is used for canned\nformats, other than --oneline.\n\nIt was a deliberate design decision to make \"--format=<string>\" as a\nshort-hand for \"--pretty=tformat:<string>\", favouring \"tformat:\"\nover \"format:\", AFAIK.  To use the facility to show a break between\neach (likely multi-line) record, use \"--pretty=format:<string>\", not\n\"--pretty=tformat:<string>\" aka \"--format=<string>\".\n"},{"id":"254769","messageId":"xmqqegqv7sn8.fsf@gitster.dls.corp.google.com","threadId":"38371","inReplyTo":"54B7E98B.6020907@drmicha.warpmail.net","subject":"Re: cosmetic bug: \"git show --pretty:format\" produces different output than \"git show --format\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-01-15T19:25:47Z","receivedAt":"2015-01-15T19:25:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> The first part of the man page is a bit sloppy, but refers to the FORMAT\n> section. There, it says that \"--pretty\" is equivalent to\n> \"--pretty=tformat:\" which is different from \"--pretty=format:\".\n\nIt is indeed sloppy.  It says --(pretty|format)=<format> can take\nthese canned <format>s or 'format:<string>', but\n\n - it does not say it can also take 'tformat:<string>' at all; and\n\n - it does not say a <format> that is none of the above is dwimmed\n   with 'tformat:' prefixed.\n\nPerhaps something like this is needed.\n\n\n Documentation/pretty-options.txt | 10 +++++++---\n 1 file changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt\nindex 8569e29..7e17af9 100644\n--- a/Documentation/pretty-options.txt\n+++ b/Documentation/pretty-options.txt\n@@ -3,9 +3,13 @@\n \n \tPretty-print the contents of the commit logs in a given format,\n \twhere '<format>' can be one of 'oneline', 'short', 'medium',\n-\t'full', 'fuller', 'email', 'raw' and 'format:<string>'.  See\n-\tthe \"PRETTY FORMATS\" section for some additional details for each\n-\tformat.  When omitted, the format defaults to 'medium'.\n+\t'full', 'fuller', 'email', 'raw', 'format:<string>'\n+\tand 'tformat:<string>'.  When '<format>' is none of the above,\n+\tacts as if '--pretty=tformat:<format>' were given.\n++\n+See\n+the \"PRETTY FORMATS\" section for some additional details for each\n+format.  When omitted, the format defaults to 'medium'.\n +\n Note: you can specify the default pretty format in the repository\n configuration (see linkgit:git-config[1]).\n"}]}