summaryrefslogtreecommitdiff
path: root/t/lib-t6000.sh
diff options
context:
space:
mode:
authorLibravatar Jonathan Nieder <jrnieder@gmail.com>2010-08-18 20:50:14 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-08-21 23:04:29 -0700
commit5a12c8864b9485351547a45fc759dde30dd1d870 (patch)
tree541cc5a79d07ecb514347e9571dba7f89d533036 /t/lib-t6000.sh
parenttests: exercise "git apply" with weird filenames (diff)
downloadtgif-5a12c8864b9485351547a45fc759dde30dd1d870.tar.xz
apply: handle traditional patches with space in filename
To discover filenames from the --- and +++ lines in a traditional unified diff, currently "git apply" scans forward for a whitespace character on each line and stops there. It can't use the whole line because "diff -u" likes to include timestamps, like so: --- foo 2000-07-12 16:56:50.020000414 -0500 +++ bar 2010-07-12 16:56:50.020000414 -0500 The whitespace-seeking heuristic works great, even when the tab has been converted to spaces by some email + copy-and-paste related corruption. Except for one problem: if the filename itself contains whitespace, the inferred filename will be too short. When Giuseppe ran into this problem, it was for a file creation patch (for debian/licenses/LICENSE.global BSD-style Chromium). So one can't use the list of files present in the index to deduce an appropriate filename (not to mention that way lies madness; see v0.99~402, 2005-05-31). Instead, look for a timestamp and use that if present to mark the end of the filename. If no timestamp is present, the old heuristic is used, with one exception: the space character \040 is not considered terminating whitespace any more unless it is followed by a timestamp. Reported-by: Giuseppe Iuculano <iuculano@debian.org> Acked-by: Guido Günther <agx@sigxcpu.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-t6000.sh')
0 files changed, 0 insertions, 0 deletions