diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-07-22 14:48:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-07-22 15:37:55 -0700 |
commit | 55d5d5bab7c3f9ab6310b9cf436a7935d7d32165 (patch) | |
tree | cf01cae48bc434249284890c0fab469504504600 /t/t0022-crlf-rename.sh | |
parent | 78d3b06e0f5e6aaea001ee8e3e7c8e401dc4b244 (diff) | |
download | git-55d5d5bab7c3f9ab6310b9cf436a7935d7d32165.tar.gz git-55d5d5bab7c3f9ab6310b9cf436a7935d7d32165.tar.xz |
combine-diff.c: fix performance problem when folding common deleted lines
For a deleted line in a patch with the parent we are looking at, the
append_lost() function finds the same line among a run of lines that were
deleted from the same location by patches from parents we previously
checked. This is so that patches with two parents
@@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
one one
-two -two
three three
-quatro -fyra
+four +four
can be coalesced into this sequence, reusing one line that describes the
removal of "two" for both parents.
@@@ -1,4 -1,4 +1,3 @@@
one
--two
three
- quatro
-frya
++four
While reading the second patch (that removes "two" and then "fyra"), after
finding where removal of the "two" matches, we need to find existing
removal of "fyra" (if exists) in the removal list, but the match has to
happen after all the existing matches (in this case "two"). The code used
a naïve O(n^2) algorithm to compute this by scanning the whole removal
list over and over again.
This patch remembers where the next scan should be started in the existing
removal list to avoid this.
Noticed by Linus Torvalds.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0022-crlf-rename.sh')
0 files changed, 0 insertions, 0 deletions