1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-06 00:36:14 +02:00

Fix deletion of last character in levenshtein distance

Without this change, "git tags" will not suggest "git tag"
(it will only suggest "git status"), and "git statusx" will
not suggest anything.

Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Samuel Tardieu 2008-11-18 19:53:26 +01:00 committed by Junio C Hamano
parent 6fc4a7e546
commit 13c6bcd49f

View File

@ -25,7 +25,7 @@ int levenshtein(const char *string1, const char *string2,
row2[j + 1] > row0[j - 1] + w)
row2[j + 1] = row0[j - 1] + w;
/* deletion */
if (j + 1 < len2 && row2[j + 1] > row1[j + 1] + d)
if (row2[j + 1] > row1[j + 1] + d)
row2[j + 1] = row1[j + 1] + d;
/* insertion */
if (row2[j + 1] > row2[j] + a)