Re: git log --pretty=format joins lines in the subject of commit message
- From
Kirill Likhodedov <kirill.likhodedov@jetbrains.com>
- Date
- Sep 17, 2010, 11:56 UTC
- Message-ID
- <4D8D88A4-FEBF-4FA9-A39F-410D76289E4B@jetbrains.com>
- In-Reply-To
- <AANLkTikXwKBUKvrNs3ezKWjBh35Y87q6gZKSyZ=1cZyG@mail.gmail.com>
I think that if it is a feature, it should be reflected in the documentation for custom pretty formats.
Anyway, that doesn't seem consistent enough: Git knows that the subject is "first line\nsecond line\nthird line" (because it shows it correctly in full or raw formats). Why does it join the lines in the custom format's %s?
I know I can just use raw format, I'm just concerned about git log behavior consistency.
15.09.2010, в 17:01, Ævar Arnfjörð Bjarmason написал(а):
Show 28 quoted lines
> On Wed, Sep 15, 2010 at 12:55, Kirill Likhodedov > <Kirill.Likhodedov@jetbrains.com> wrote: >> Commit something to a git repository with a commit message with several newlines like this: >> >> ==== commit message starts below === >> first line >> second line >> third line >> >> fifth line >> === commit message ends above === >> >> Git treats the first 3 lines as commit message subject and the last line as its body. >> >> 'git log' shows the commit message correctly - exactly like I've entered. So does 'git log --pretty=raw' >> >> But 'git log --pretty=format:%s#%b' joins the first three lines: >> first line second line third line#fifth line >> >> Is it a bug or a feature? > > It's probably a feature. We delimit the subject by "\n\n", not > "\n". And IIRC subjects in E-Mail can contain \n. > >> If it is a feature how can I acquire the original subject of the commit message by using custom format? > > Use a log format that gives you the complete message, then pipe it > through perl or something to parse it?
---------------------------------- Kirill Likhodedov JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!"