[PATCH] Fix deletion of last character in levenshtein distance

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Samuel Tardieu
Date: Tuesday, November 18, 2008 - 11:53 am

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>
---
 levenshtein.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/levenshtein.c b/levenshtein.c
index db52f2c..98fea72 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)

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix deletion of last character in levenshtein distance, Samuel Tardieu, (Tue Nov 18, 11:53 am)
Re: [PATCH] Fix deletion of last character in levenshtein ..., Johannes Schindelin, (Tue Nov 18, 5:53 pm)
Re: [PATCH] Fix deletion of last character in levenshtein ..., Johannes Schindelin, (Wed Nov 19, 2:57 am)
Re: [PATCH] Document levenshtein.c, Samuel Tardieu, (Thu Nov 20, 5:00 am)
[PATCH] Document levenshtein.c, Johannes Schindelin, (Thu Nov 20, 5:00 am)
[PATCH v2] Document levenshtein.c, Johannes Schindelin, (Thu Nov 20, 6:27 am)
Re: [PATCH v2] Document levenshtein.c, Jon Loeliger, (Thu Nov 20, 10:21 am)
Re: [PATCH v2] Document levenshtein.c, Sverre Rabbelier, (Thu Nov 20, 10:48 am)
Re: [PATCH v2] Document levenshtein.c, Johannes Schindelin, (Thu Nov 20, 11:31 am)