Skip to content

Commit 13c6bcd

Browse files
samueltardieugitster
authored andcommitted
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 <[email protected]> Acked-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6fc4a7e commit 13c6bcd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

levenshtein.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int levenshtein(const char *string1, const char *string2,
2525
row2[j + 1] > row0[j - 1] + w)
2626
row2[j + 1] = row0[j - 1] + w;
2727
/* deletion */
28-
if (j + 1 < len2 && row2[j + 1] > row1[j + 1] + d)
28+
if (row2[j + 1] > row1[j + 1] + d)
2929
row2[j + 1] = row1[j + 1] + d;
3030
/* insertion */
3131
if (row2[j + 1] > row2[j] + a)

0 commit comments

Comments
 (0)