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

Re: git-diff/git-format-patch safe for GNU (or POSIX) patch?

From
Karl Hasselström <kha@treskal.com>
Date
Jun 26, 2008, 10:36 UTC
Message-ID
<20080626103607.GA16525@diana.vm.bytemark.co.uk>
In-Reply-To
<58230.213.203.159.164.1214476059.squirrel@upmail.polettix.it>
On 2008-06-26 12:27:39 +0200, Flavio Poletti wrote:
Show 10 quoted lines
> When I was happy with the modifications, I used git-format-patch to
> produce the message and the patch to send. I then saw that the
> format is a little different with respect to what diff -u produces;
> in particular, I noticed that there was an added line between the
> "diff --git..." line and the one stating the "origin" file:
>
>                    diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
> *** this one ***   index 61d11ed..7786f10 100644
>                    --- a/glib/gstrfuncs.c
>                    +++ b/glib/gstrfuncs.c
patch ignores any junk it doesn't understand, including this line.
> Moreover, each chunk's header contained added stuff, like the
> "g_ascii_strtoll..." stuff in the following example line:
>
>     @@ -813,6 +813,8 @@ g_ascii_strtoll (const gchar *nptr,

You get this by giving the -p flag to GNU diff; git diff just does it by default, is all.

> 4. some hints to use git for working on projects that do not use any
> other VCS, or for which one only wants to produce and send a quick
> patch starting from a tarball.

You can use git/contrib/fast-import/import-tars.perl to import the last few releases into git (possibly just the last release, if you don't need the history) and then just build on that, and send patches back to the project when you're done.

When the project makes another release, use import-tars to import the new tarball, and then rebase if you have any patches they haven't accepted yet.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Previous: Flavio PolettiNext: Flavio Poletti
Message 2 of 5 in “git-diff/git-format-patch safe for GNU (or POSIX) patch?”
  1. Flavio PolettiJun 26, 2008
  2. Karl HasselströmJun 26, 2008
  3. Flavio PolettiJun 26, 2008
  4. Karl HasselströmJun 26, 2008
  5. Petr BaudisJun 26, 2008

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.