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

Re: Applying a patch with a diff header in its commit message

From
Pratyush Yadav <me@yadavpratyush.com>
Date
Jul 6, 2021, 08:17 UTC
Message-ID
<20210706081738.5th24lypiicnbckv@yadavpratyush.com>
In-Reply-To
<60da5ed21ec8c_1f78f2082a@natae.notmuch>
On 28/06/21 06:44PM, Felipe Contreras wrote:
Show 13 quoted lines
> Pratyush Yadav wrote:
> > I have a patch at $DAYJOB that contains a diff header ("diff --git 
> > a/...") in its commit message, and unfortunately it is not indented. So 
> > naturally, git-am trips up and thinks it is the start of the main diff 
> > and tries to apply the diff starting there. It does not apply and the 
> > patch is rejected as being corrupt.
> > 
> > I know one option for me is to manually edit the patch and indent the 
> > diff header. But I would like to avoid that if possible. Is there any 
> > way to apply that patch as-is? Is it possible to tell git-am where to 
> > start looking for the diff?
> 
> git apply?

Sure, that is an option. But then I would have to copy/paste the commit message and add the author information manually. Is there any way to do this automatically? What if I have 100 commits like this?

This is a valid Git commit. It would be nice if the Git email tooling could handle it cleanly.

-- 
Regards,
Pratyush Yadav
Previous: Felipe ContrerasNext: Ævar Arnfjörð Bjarmason
Message 3 of 5 in “Applying a patch with a diff header in its commit message”
  1. Pratyush YadavJun 28, 2021
  2. Felipe ContrerasJun 28, 2021
  3. Pratyush YadavJul 6, 2021
  4. Ævar Arnfjörð BjarmasonJul 6, 2021
  5. Felipe ContrerasJul 6, 2021

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.