summaryrefslogtreecommitdiff
path: root/builtin/check-mailmap.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-01-16 23:32:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-01-22 20:57:24 (GMT)
commit407a792ef7e3c142a47c6b09a80f9ede4e14f444 (patch)
tree4ef03e8ec231ab48e06704da83fd79f151e714b8 /builtin/check-mailmap.c
parent2988289f2c5764605105037bfcb12f85b9971cf9 (diff)
downloadgit-407a792ef7e3c142a47c6b09a80f9ede4e14f444.zip
git-407a792ef7e3c142a47c6b09a80f9ede4e14f444.tar.gz
git-407a792ef7e3c142a47c6b09a80f9ede4e14f444.tar.bz2
apply: count the size of postimage correctly
Under --whitespace=fix option, match_fragment() function examines the preimage (the common context and the removed lines in the patch) and the file being patched and checks if they match after correcting all whitespace errors. When they are found to match, the common context lines in the preimage is replaced with the fixed copy, because these lines will then be copied to the corresponding place in the postimage by a later call to update_pre_post_images(). Lines that are added in the postimage, under --whitespace=fix, have their whitespace errors already fixed when apply_one_fragment() prepares the preimage and the postimage, so in the end, application of the patch can be done by replacing the block of text in the file being patched that matched the preimage with what is in the postimage that was updated by update_pre_post_images(). In the earlier days, fixing whitespace errors always resulted in reduction of size, either collapsing runs of spaces in the indent to a tab or removing the trailing whitespaces. These days, however, some whitespace error fix results in extending the size. 250b3c6c (apply --whitespace=fix: avoid running over the postimage buffer, 2013-03-22) tried to compute the final postimage size but its math was flawed. It counted the size of the block of text in the original being patched after fixing the whitespace errors on its lines that correspond to the preimage. That number does not have much to do with how big the final postimage would be. Instead count (1) the added lines in the postimage, whose size is the same as in the final patch result because their whitespace errors have already been corrected, and (2) the fixed size of the lines that are common. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/check-mailmap.c')
0 files changed, 0 insertions, 0 deletions