author | Björn Steinbrink <B.Steinbrink@gmx.de> | |
Tue, 20 Jan 2009 15:59:57 +0000 (16:59 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 21 Jan 2009 08:14:12 +0000 (00:14 -0800) | ||
commit | 885c716f0f039cfe100f5d761e1011085b43fbb8 | |
tree | 89803d99495f838aba85b1c68be6ed0b04f8438a | tree | snapshot |
parent | 3aed2fda6f8233895be0d1142c4c4b407fb692c3 | commit | diff |
Rename detection: Avoid repeated filespec population
In diffcore_rename, we assume that the blob contents in the filespec
aren't required anymore after estimate_similarity has been called and thus
we free it. But estimate_similarity might return early when the file sizes
differ too much. In that case, cnt_data is never set and the next call to
estimate_similarity will populate the filespec again, eventually rereading
the same blob over and over again.
To fix that, we first get the blob sizes and only when the blob contents
are actually required, and when cnt_data will be set, the full filespec is
populated, once.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In diffcore_rename, we assume that the blob contents in the filespec
aren't required anymore after estimate_similarity has been called and thus
we free it. But estimate_similarity might return early when the file sizes
differ too much. In that case, cnt_data is never set and the next call to
estimate_similarity will populate the filespec again, eventually rereading
the same blob over and over again.
To fix that, we first get the blob sizes and only when the blob contents
are actually required, and when cnt_data will be set, the full filespec is
populated, once.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-rename.c | diff | blob | history |