Skip to content

Commit

Permalink
Fix deletion of last character in levenshtein distance
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Samuel Tardieu authored and Junio C Hamano committed Nov 24, 2008
1 parent 6fc4a7e commit 13c6bcd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion levenshtein.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 13c6bcd

Please sign in to comment.