Revision b67b9612e1a90ae093445abeaeff930e9f4cf936 authored by Junio C Hamano on 26 January 2009, 08:08:24 UTC, committed by Junio C Hamano on 27 January 2009, 08:48:00 UTC
A patch that changes the filetype (e.g. regular file to symlink) of a path
must be split into a deletion event followed by a creation event, which
means that we need to have two independent metainfo lines for each.
However, the code reused the single set of metainfo lines.

As the blob object names recorded on the index lines are usually not used
nor validated on the receiving end, this is not an issue with normal use
of the resulting patch.  However, when accepting a binary patch to delete
a blob, git-apply verified that the postimage blob object name on the
index line is 0{40}, hence a patch that deletes a regular file blob that
records binary contents to create a blob with different filetype (e.g. a
symbolic link) failed to apply.  "git am -3" also uses the blob object
names recorded on the index line, so it would also misbehave when
synthesizing a preimage tree.

This moves the code to generate metainfo lines around, so that two
independent sets of metainfo lines are used for the split halves.

Additional tests by Jeff King.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b938f62
History
File Mode Size
xdiff.h -rw-r--r-- 2.9 KB
xdiffi.c -rw-r--r-- 14.4 KB
xdiffi.h -rw-r--r-- 1.8 KB
xemit.c -rw-r--r-- 5.1 KB
xemit.h -rw-r--r-- 1.1 KB
xinclude.h -rw-r--r-- 1.2 KB
xmacros.h -rw-r--r-- 1.9 KB
xmerge.c -rw-r--r-- 12.1 KB
xprepare.c -rw-r--r-- 11.1 KB
xprepare.h -rw-r--r-- 1.1 KB
xtypes.h -rw-r--r-- 1.6 KB
xutils.c -rw-r--r-- 7.5 KB
xutils.h -rw-r--r-- 1.7 KB

back to top