git-commit-vandalism/builtin
Jonathan Nieder 5a12c8864b 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>
2010-08-21 23:04:29 -07:00
..
add.c git add: Add the "--ignore-missing" option for the dry run 2010-07-12 15:13:54 -07:00
annotate.c
apply.c apply: handle traditional patches with space in filename 2010-08-21 23:04:29 -07:00
archive.c
bisect--helper.c
blame.c Merge branch 'cp/textconv-cat-file' 2010-06-27 12:07:55 -07:00
branch.c Merge branch 'sm/branch-broken-ref' 2010-06-21 06:02:47 -07:00
bundle.c
cat-file.c Merge branch 'cp/textconv-cat-file' 2010-06-27 12:07:55 -07:00
check-attr.c Move 'builtin-*' into a 'builtin/' subdirectory 2010-02-22 14:29:41 -08:00
check-ref-format.c
checkout-index.c
checkout.c Merge branch 'gv/portable' 2010-06-21 06:02:44 -07:00
clean.c
clone.c Merge branch 'ph/clone-message-reword' 2010-06-18 11:16:53 -07:00
commit-tree.c
commit.c Merge branch 'jk/maint-status-keep-index-timestamp' 2010-07-15 12:06:55 -07:00
config.c
count-objects.c
describe.c Merge branch 'sp/maint-describe-tiebreak-with-tagger-date' into maint 2010-06-16 16:21:15 -07:00
diff-files.c
diff-index.c
diff-tree.c Merge branch 'pb/log-first-parent-p-m' 2010-03-24 16:25:39 -07:00
diff.c Merge branch 'jc/diff-merge-base-multi' 2010-07-16 15:45:35 -07:00
fast-export.c string_list: Fix argument order for string_list_append 2010-06-27 10:06:52 -07:00
fetch-pack.c Move 'builtin-*' into a 'builtin/' subdirectory 2010-02-22 14:29:41 -08:00
fetch.c Merge branch 'jp/string-list-api-cleanup' 2010-06-30 11:55:38 -07:00
fmt-merge-msg.c Merge branch 'jp/string-list-api-cleanup' 2010-06-30 11:55:38 -07:00
for-each-ref.c Merge branch 'maint' 2010-06-07 22:15:31 -07:00
fsck.c
gc.c
grep.c Merge branch 'jn/grep-open' 2010-07-15 12:07:18 -07:00
hash-object.c
help.c enums: omit trailing comma for portability 2010-05-31 16:59:27 -07:00
index-pack.c Merge branch 'np/index-pack-memsave' into maint 2010-06-16 16:22:23 -07:00
init-db.c
log.c Merge branch 'ar/decorate-color' 2010-06-30 11:55:40 -07:00
ls-files.c Merge branch 'jp/string-list-api-cleanup' 2010-06-30 11:55:38 -07:00
ls-remote.c
ls-tree.c
mailinfo.c enums: omit trailing comma for portability 2010-05-31 16:59:27 -07:00
mailsplit.c string_list: Fix argument order for string_list_insert 2010-06-27 10:06:51 -07:00
merge-base.c
merge-file.c Merge branch 'rs/diff-no-minimal' into maint 2010-06-21 05:38:50 -07:00
merge-index.c
merge-ours.c
merge-recursive.c
merge-tree.c merge-tree: fix where two branches share no changes 2010-07-14 12:56:49 -07:00
merge.c Merge branch 'tc/merge-m-log' 2010-06-18 11:16:54 -07:00
mktag.c
mktree.c
mv.c string_list: Fix argument order for string_list_insert 2010-06-27 10:06:51 -07:00
name-rev.c
notes.c Merge branch 'maint' 2010-06-28 17:42:26 -07:00
pack-objects.c Merge branch 'np/malloc-threading' into maint 2010-06-16 16:21:06 -07:00
pack-redundant.c
pack-refs.c
patch-id.c
prune-packed.c
prune.c
push.c
read-tree.c Merge remote branch 'ko/master' into jc/read-tree-cache-tree-fix 2010-07-08 18:55:50 -07:00
receive-pack.c Merge branch 'tr/receive-pack-aliased-update-fix' into maint 2010-07-07 10:25:15 -07:00
reflog.c Merge branch 'jc/maint-no-reflog-expire-unreach-for-head' 2010-05-21 04:02:18 -07:00
remote.c Merge branch 'jp/string-list-api-cleanup' 2010-06-30 11:55:38 -07:00
replace.c
rerere.c Merge branch 'js/merge-rr-fix' 2010-07-15 12:08:36 -07:00
reset.c
rev-list.c rev-list: introduce --count option 2010-06-12 09:39:06 -07:00
rev-parse.c Merge branch 'maint' 2010-07-07 11:18:26 -07:00
revert.c revert: do not rebuild argv on heap 2010-06-29 10:36:13 -07:00
rm.c Move 'builtin-*' into a 'builtin/' subdirectory 2010-02-22 14:29:41 -08:00
send-pack.c Merge branch 'ld/push-porcelain' 2010-03-15 00:58:24 -07:00
shortlog.c string_list: Fix argument order for string_list_append 2010-06-27 10:06:52 -07:00
show-branch.c show-branch: use DEFAULT_ABBREV instead of 7 2010-05-25 09:48:49 -07:00
show-ref.c string_list: Fix argument order for string_list_insert 2010-06-27 10:06:51 -07:00
stripspace.c
symbolic-ref.c
tag.c
tar-tree.c
unpack-file.c
unpack-objects.c
update-index.c
update-ref.c
update-server-info.c
upload-archive.c
var.c
verify-pack.c
verify-tag.c
write-tree.c