From 13c6bcd49f8151438aa3302b8764c6f8d42441e2 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 18 Nov 2008 19:53:26 +0100 Subject: [PATCH] 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 Acked-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- levenshtein.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/levenshtein.c b/levenshtein.c index db52f2c20..98fea723d 100644 --- a/levenshtein.c +++ b/levenshtein.c @@ -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) -- 2.26.2