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

Re: serious problem with `git format-patch' & `git am'

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 26, 2009, 10:42 UTC
Message-ID
<alpine.DEB.1.00.0902261138260.6258@intel-tinevez-2-302>
In-Reply-To
<20090225.230352.177616203.wl@gnu.org>
Hi,
[welcome on the Git list, Werner!]
On Wed, 25 Feb 2009, Werner LEMBERG wrote:
Show 49 quoted lines
> 
> [both version 1.6.0.2 and git from 2009-01-24]
> 
> Folks,
> 
> 
> I'm going to convert the FreeType CVS repository to git, using Keith
> Packard's `parsecvs'.  It sometimes happens that there are git entries
> titled
> 
>   *** empty log message ***
> 
> I want to massage the git repository before publishing it, replacing
> those entries with something more meaningful.
> 
> The last time I tested this (using git 1.5.something, I no longer
> remember the exact version) I did the following:
> 
>   . git format-patch <start>..HEAD
>     git reset --hard <start>
> 
>   . Edit the `Subject:' field in the created *.patch files where
>     necessary.
> 
>   . git am --whitespace=nowarn *.patch
> 
> Unfortunately, this no longer works as before, and since I can't find
> a hint in the docs about this change I wonder whether it is a bug.
> 
> With git 1.5.something, if the first paragraph of the commit message
> (as output by parsecvs) looks like this
> 
>    foo foo foo foo
>    bar bar bar bar
>    baz baz baz baz
> 
> it is emitted exactly as-is (after `git format-patch' & `git am');
> gitk shows `foo foo foo foo' as the first line.  However, git version
> 1.6.0.2 and the current git both convert newlines to spaces in the
> first paragraph!  I now get
> 
>   foo foo foo foo bar bar bar bar baz baz baz baz
> 
> as the beginning of the commit message which is VERY bad since
> CVS-style entries often have a long first paragraph, causing
> ugly-looking, overlong lines.
> 
> In case this is an intended change I ask you urgently to provide an
> option to get back the old behaviour of `git format-patch' & `git am'.

It is an intended change, for the _opposite_ case: some people thrive on overly-long subject lines, and the change was supposed to help them.

I was not sure if it would be a good change back then, but I did not have anything concrete I could present as an example where the behavior hurts.

In your case, I suggest using something different, though. Either use "rebase -i" and mark the commits you want to massage as "edit", or use "fast-export > dump", edit "dump" by hand, and then reimport the whole thing using fast-import.

IMHO your use case is not a good candidate for format-patch, as that program was really meant for patch submission (even if it also serves other purposes pretty well).

Ciao, Dscho

Previous: Werner LEMBERGNext: Brandon Casey
Message 2 of 8 in “serious problem with `git format-patch' & `git am'”
  1. Werner LEMBERGFeb 25, 2009
  2. Johannes SchindelinFeb 26, 2009
  3. Brandon CaseyFeb 26, 2009
  4. Jakub NarebskiFeb 27, 2009
  5. Junio C HamanoFeb 27, 2009
  6. Brandon CaseyFeb 27, 2009
  7. Junio C HamanoFeb 27, 2009
  8. Werner LEMBERGFeb 27, 2009

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.