summaryrefslogtreecommitdiff
path: root/t/t7701-repack-unpack-unreachable.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-03-26 13:42:06 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-03-26 14:02:33 -0700
commit14d3bb4955a41e146b6f1cd6571602a6b46b2af9 (patch)
tree2eb0aeab2f3e9347ba909c57592dfc59151fe495 /t/t7701-repack-unpack-unreachable.sh
parentGit 1.8.5.5 (diff)
downloadtgif-14d3bb4955a41e146b6f1cd6571602a6b46b2af9.tar.xz
apply --ignore-space-change: lines with and without leading whitespaces do not match
The fuzzy_matchlines() function is used when attempting to resurrect a patch that is whitespace-damaged, or when applying a patch that was produced against an old codebase to the codebase after indentation change. The patch may want to change a line "a_bc" ("_" is used throught this description for a whitespace to make it stand out) in the original into something else, and we may not find "a_bc" in the current source, but there may be "a__bc" (two spaces instead of one the whitespace-damaged patch claims to expect). By ignoring the amount of whitespaces, it forces "git apply" to consider that "a_bc" in the broken patch meant to refer to "a__bc" in reality. However, the implementation special cases a run of whitespaces at the beginning of a line and makes "abc" match "_abc", even though a whitespace in the middle of string never matches a 0-width gap, e.g. "a_bc" does not match "abc". A run of whitespace at the end of one string does not match a 0-width end of line on the other line, either, e.g. "abc_" does not match "abc". Fix this inconsistency by making the code skip leading whitespaces only when both strings begin with a whitespace. This makes the option mean the same as the option of the same name in "diff" and "git diff". Note that I am not sure if anybody sane should use this option in the first place. The fuzzy match logic may be able to find the original line that the patch author may have meant to touch because it does not fully trust what the original lines say (i.e. context lines prefixed by " " and old lines prefixed by "-" does not have to exactly match the contents the patch is applied to). There is no reason for us to trust what the replacement lines (i.e. new lines prefixed by "+") say, either, but with this option enabled, we end up copying these new lines with suspicious whitespace distributions literally into the patched result. But as long as we keep it, we should make it do its insane thing consistently. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7701-repack-unpack-unreachable.sh')
0 files changed, 0 insertions, 0 deletions