git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@rfc1149.net>
To: git@vger.kernel.org
Subject: [PATCH] Fix deletion of last character in levenshtein distance
Date: Tue, 18 Nov 2008 19:53:26 +0100	[thread overview]
Message-ID: <20081118185326.12721.71576.stgit@arrakis.enst.fr> (raw)

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)

             reply	other threads:[~2008-11-18 18:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18 18:53 Samuel Tardieu [this message]
2008-11-18 20:23 ` [PATCH] Fix deletion of last character in levenshtein distance Matthieu Moy
2008-11-19  0:53 ` Johannes Schindelin
2008-11-19  8:42   ` Samuel Tardieu
2008-11-19  9:57     ` Johannes Schindelin
2008-11-19 13:13       ` Junio C Hamano
2008-11-20 12:00         ` [PATCH] Document levenshtein.c Johannes Schindelin
2008-11-20 12:00           ` Samuel Tardieu
2008-11-20 13:27             ` [PATCH v2] " Johannes Schindelin
2008-11-20 17:21               ` Jon Loeliger
2008-11-20 17:48                 ` Sverre Rabbelier
2008-11-20 18:31                 ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081118185326.12721.71576.stgit@arrakis.enst.fr \
    --to=sam@rfc1149.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).