summaryrefslogtreecommitdiff
path: root/t/t4135-apply-weird-filenames.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-08-18 20:50:14 -0500
committerJunio C Hamano <gitster@pobox.com>2010-08-21 23:04:29 -0700
commit5a12c8864b9485351547a45fc759dde30dd1d870 (patch)
tree541cc5a79d07ecb514347e9571dba7f89d533036 /t/t4135-apply-weird-filenames.sh
parentc51c0da2225d65ec1984d40bacbc3f43a0bfa178 (diff)
downloadgit-5a12c8864b9485351547a45fc759dde30dd1d870.tar.gz
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/t4135-apply-weird-filenames.sh')
-rwxr-xr-xt/t4135-apply-weird-filenames.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index 9373f644a8..1e5aad57ab 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -59,8 +59,8 @@ try_filename() {
}
try_filename 'plain' 'postimage.txt'
-try_filename 'with spaces' 'post image.txt' '' success failure failure
-try_filename 'with tab' 'post image.txt' FUNNYNAMES success failure failure
+try_filename 'with spaces' 'post image.txt'
+try_filename 'with tab' 'post image.txt' FUNNYNAMES
try_filename 'with backslash' 'post\image.txt' BSLASHPSPEC
try_filename 'with quote' '"postimage".txt' FUNNYNAMES success failure success