git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Reduce cost of deletion in levenstein distance (4 -> 3)

From
Junio C Hamano <gitster@pobox.com>
Date
May 29, 2012, 18:25 UTC
Message-ID
<7v4nqy6e0k.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1338134578-29011-1-git-send-email-Matthieu.Moy@imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 15 quoted lines
> Before this patch, a character deletion has the same cost as 2 swaps, or
> 4 additions, so Git prefers suggesting a completely scrambled command
> name to removing a character. For example, "git tags" suggests "stage",
> but not "tag".
>
> By setting the deletion cost to 3, we keep it higher than swaps or
> additions, but prefer 1 deletion to 2 swaps. "git tags" now suggests
> "tag" in addition to staged.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> The RFC sent earlier [1] didn't receive negative comments, so I think this
> is a good change.
>
> http://thread.gmane.org/gmane.comp.version-control.git/196457

Lack of objections is never a good reason to assume it is a good change. In this particular case, I think the reason why you saw no comments, either positive or negative, was because nobody came up with a more "scientific" way to judge the weighting. Choosing between "tag" and "stage" given "tags" is just one datapoint, but does not convince anybody there are not surprising combinations where this change affects negatively.

I wonder if we can mechanically find a set of parameters that optimally separates the built-in commands by computing N^2 distances (e.g. compute "tag" and all other command names and record minimum. Do so for all other commands. Now fudge the parameters and repeat to see if it results in better minimum separation. Something like that).

Having said all that, until somebody comes up with a better method of judging, I'd say that the best thing we could do is to apply this patch and see if anybody finds a "surprising" case where this leads to a regression.

Thanks.
Previous: Matthieu MoyNext: Matthieu Moy
Message 2 of 3 in “Reduce cost of deletion in levenstein distance (4 -> 3)”
  1. Reduce cost of deletion in levenstein distance (4 -> 3)Matthieu Moy, May 27, 2012
  2. Junio C HamanoMay 29, 2012
  3. Matthieu MoyMay 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.