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>
Samuel Tardieu committed
Nov 18, 2008 at 19:53 UTC
13c6bcd49f8151438aa3302b8764c6f8d42441e2
1 file changed
+1
-1
levenshtein.c
+1
-1
@@ -25,7 +25,7 @@ int levenshtein(const char *string1, const char *string2,
25
row2[j + 1] > row0[j - 1] + w)
26
row2[j + 1] = row0[j - 1] + w;
27
/* deletion */
28
- if (j + 1 < len2 && row2[j + 1] > row1[j + 1] + d)
28
+ if (row2[j + 1] > row1[j + 1] + d)
29
row2[j + 1] = row1[j + 1] + d;
30
/* insertion */
31
if (row2[j + 1] > row2[j] + a)