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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

   I had to dig a problem in Glib ("base" library for GTK) in Debian Etch
recently and I decided to manage changes/diffs with git. It's just so
easy to use and avoids all the usual copy-the-tree-then-diff that I
used before.

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

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,

Before sending the patch, I tried to "reverse" these "deviations" from the
normal diff output, but I was quite sure there was no need to do this. I
then tried to use GNU patch with the unaltered message, and it seemed
quite happy with all the extra stuff.

Just to be on the safe side, I tried to look for:
1. the "official" unified diff spec
2. a description of what patch is willing to consider valid input
3. some notes about how git-diff copes with patch compatibility
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.

I had no luck with the first two attempts, and a moderate luck with the
third: there is more than one email from Junio C. Hamano either stating
that git-diff strives to be nice with patch, or containing patches to
address possible conformance issues. I was also quite unluck with the
fourth attempt, even if this is surely due to my poor websurfing-fu.

Anyway, the messages from Mr. Hamano kind-of answer the question in the
subject, but in a somehow "implicit" way rather than explicitly. In
particular, I wonder if there is any document about how a "valid" unified
diff should look like (including optional valid extensions) that was used
as input and reference for git-diff development. Or had you just to figure
it out from diff/patch sources?

Thank you,

   Flavio.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux