builtin-apply.c: make it more line oriented
commitb94f2eda99646fea71f84ccd895d94b0001d0db6
authorJunio C Hamano <gitster@pobox.com>
Sun, 27 Jan 2008 01:42:49 +0000 (26 17:42 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 Feb 2008 08:38:41 +0000 (5 00:38 -0800)
tree876414083f4b3e2d70922f756bb40bf87b74b61f
parentdc41976a3eed1d9c93fdc08c448bab969db4e0ec
builtin-apply.c: make it more line oriented

This changes the way git-apply internally works to be more line
oriented.  The logic to find where the patch applies with offset
used to count line numbers by always counting LF from the
beginning of the buffer, but it is simplified because we count
the line length of the target file and the preimage snippet
upfront now.

The ultimate motivation is to allow applying patches
whose preimage context has whitespace corruption that has
already been corrected in the local copy.  For that purpose, we
introduce a table of line-hash that allows us to match lines
that differ only in whitespaces.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-apply.c