git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to get the original raw commit message without removing extra leading/trailing line breaks

From
PMEase <robin@pmease.com>
Date
Mar 28, 2022, 06:11 UTC
Message-ID
<0D9BB163-A369-47DE-A0DC-AD396FD6DBE4@pmease.com>
In-Reply-To
<xmqq5yny62s1.fsf@gitster.g>
It also converts \r\n to \n and remove all spaces in a blank line. This is reasonable for a readable commit message, but makes it impossible to verify signature in my program...
Show 19 quoted lines
> On Mar 28, 2022, at 1:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> PMEase <robin@pmease.com> writes:
> 
> [jc: wrapped overly long lines]
> 
>> I am using command "git show --format=raw <commit hash>" to get
>> raw commit object in order to verify the GPG signature in my
>> program to customize public key loading. However in the raw commit
>> object, extra line breaks before and after the commit message is
>> removed, which cause the signature verification failure as git
>> generates the signature without removing those line breaks.
> 
> "git show --format=raw <commit object name>" will not give "raw
> commit object" to begin with.  It indents the message by four
> spaces.
> 
> "git cat-file commit <commit object name>" is what you want, I
> think.
Previous: Junio C Hamano
Message 5 of 5 in “How to get the original raw commit message without removing extra leading/trailing line breaks”
  1. PMEaseMar 28, 2022
  2. Junio C HamanoMar 28, 2022
  3. PMEaseMar 28, 2022
  4. Junio C HamanoMar 28, 2022
  5. PMEaseMar 28, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.