git-diff/git-apply: make diff output a bit friendlier to GNU patch (part 1)
commitce74618d95088d99de53fb691f361da05932f705
authorJunio C Hamano <junkio@cox.net>
Fri, 22 Sep 2006 23:17:58 +0000 (22 16:17 -0700)
committerJunio C Hamano <junkio@cox.net>
Sat, 30 Sep 2006 02:20:27 +0000 (29 19:20 -0700)
treebe7851850631b081a7b3dbfeefc94cf6bf09cc9d
parent4839bd8a6605e0c9c5c68ddec40d2a1a5ddd57d8
git-diff/git-apply: make diff output a bit friendlier to GNU patch (part 1)

Somebody was wondering on #git channel why a git generated diff
does not apply with GNU patch when the filename contains a SP.
It is because GNU patch expects to find TAB (and trailing timestamp)
on ---/+++ (old_name and new_name) lines after the filenames.

The "diff --git" output format was carefully designed to be
compatible with GNU patch where it can, but whitespace
characters were always a pain.

We can make our output a bit more GNU patch friendly by adding an
extra TAB (but not trailing timestamp) to old/new name lines when
the filename as a SP in it.  This updates git-apply to prepare
ourselves to accept such a patch, but we still do not generate
output that is patch friendly yet.  That change needs to wait
until everybody has this change.

When a filename contains a real tab, "diff --git" format
always c-quotes it as discussed on the list with GNU patch
maintainer previously:

http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2

so there should be no downside.

Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-apply.c