* Diff filename has trailing tab if filename contains space
@ 2016-03-04 23:50 乙酸鋰
2016-03-05 0:32 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: 乙酸鋰 @ 2016-03-04 23:50 UTC (permalink / raw)
To: git
Hi,
Using git 2.7.1
Diff filename has trailing tab if filename contains space
Please run below shell script
and look at the output diff file 1.diff
There is trailing tab chars after these lines:
--- a/8 1/8.txt
+++ b/8 1/8.txt
---- b/9 86
+++ b/9 86
#!/bin/sh
set -e
git init
echo a >> "normal"
git add "normal"
echo y >> "9 86"
git add "9 86" # file name has space
mkdir x
echo d >> "x/normal"
git add "x/normal"
mkdir "8 1"
echo u >> "8 1/8.txt" # directory name has space
echo k >> "8 1/8.txt"
git add "8 1/8.txt"
git commit -m "Initial commit"
echo b >> "normal"
git add "normal"
echo c >> "9 86"
git add "9 86"
echo e >> "x/normal"
git add "x/normal"
echo h >> "8 1/8.txt"
git add "8 1/8.txt"
git commit -m "Edit files"
git diff master~1 > 1.diff
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Diff filename has trailing tab if filename contains space
2016-03-04 23:50 Diff filename has trailing tab if filename contains space 乙酸鋰
@ 2016-03-05 0:32 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2016-03-05 0:32 UTC (permalink / raw)
To: 乙酸鋰; +Cc: git
乙酸鋰 <ch3cooli@gmail.com> writes:
> Hi,
>
> Using git 2.7.1
>
> Diff filename has trailing tab if filename contains space
Thanks; that is very much deliberate and has been with us forever.
commit 1a9eb3b9d50367bee8fe85022684d812816fe531
Author: Junio C Hamano <junkio@cox.net>
Date: Fri Sep 22 16:17:58 2006 -0700
git-diff/git-apply: make diff output a bit friendlier to GNU patch (part 2)
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.
This adds an extra TAB (but not trailing timestamp) to old_name
and new_name lines of git-diff output when the filename has a SP
in it. An earlier patch updated git-apply to prepare for this.
Signed-off-by: Junio C Hamano <junkio@cox.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-05 0:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04 23:50 Diff filename has trailing tab if filename contains space 乙酸鋰
2016-03-05 0:32 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).