git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Erik Faye-Lund <kusmabite@gmail.com>
To: "Tarek Ziadé" <ziade.tarek@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: bug: unexpected output for "git st" + suggestion
Date: Tue, 23 Nov 2010 14:56:28 +0100	[thread overview]
Message-ID: <AANLkTinu+Wq84x2H0vB3rUSXbwreumrDC7k2dr5nOfjC@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=G1ZpiaRN8vWYBJ33_ZOXo1t616X5gQU+jNda_@mail.gmail.com>

On Tue, Nov 23, 2010 at 2:47 PM, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
> On Tue, Nov 23, 2010 at 2:22 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Tue, Nov 23, 2010 at 1:23 PM, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
>>> Hello,
>>>
>>> I am new to Git and I tried to run "git st"
>>>
>>> I have found one small bug: "status" is not listed in the help screen
>>> Git displays in that case.
>>>
>>> $ git st
>>> git: 'st' is not a git command. See 'git --help'.
>>>
>>> Did you mean one of these?
>>>        reset
>>>        stage
>>>        stash
>>>
>>
>> This isn't strictly speaking a bug. Git uses Levenshtein distance
>> (http://en.wikipedia.org/wiki/Levenshtein_distance) to figure out what
>> to suggest. If any command has a sLevenshtein distance of less than 6
>> (given our coefficients), then all commands with that distance is
>> suggested. But perhaps we should do something different
>>
>> But perhaps we could do better. We have some commands that are
>> considered more "important", ie the ones listed when doing "git help"
>> without "--all". "status" is one of these. Perhaps these commands
>> should always be included if they are below the Levenshtein distance
>> threshold or something?
>>
>
> Oh, interesting ! Levenshtein is great for typos but highly depends on
> the fact that the word I am entering has about the same length as the
> command I am looking for.
>
> When I typed "st" I was thinking about an alias/shortcut. So the
> question would be: is "st" a common alias in the git community for the
> "status" command ?
>
> If the answer is yes, and if there are other common aliases used out
> there, I would suggest keeping the Levenshtein distance as it is now,
> but complete the list of suggestions by using a "common aliases
> mapper."
>

I experimented a bit around, and the last idea I played around with
was to keep the Levenshtein-suggestions as-is, but to add all common
commands that had the entered command as a prefix. That's a bit more
generic than what you suggested, but also not as flexible as it would
have to be a strict prefix.

  reply	other threads:[~2010-11-23 13:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 12:23 bug: unexpected output for "git st" + suggestion Tarek Ziadé
2010-11-23 12:40 ` Nguyen Thai Ngoc Duy
2010-11-23 12:49   ` Tarek Ziadé
2010-11-23 13:08     ` Nguyen Thai Ngoc Duy
2010-11-23 13:18       ` Tarek Ziadé
2010-11-23 13:26         ` Nguyen Thai Ngoc Duy
2010-11-23 20:38         ` Andreas Schwab
2010-11-23 12:43 ` Sylvain Rabot
2010-11-23 13:22 ` Erik Faye-Lund
2010-11-23 13:47   ` Tarek Ziadé
2010-11-23 13:56     ` Erik Faye-Lund [this message]
2010-11-23 13:58       ` Tarek Ziadé
2010-11-23 19:11         ` [PATCH] help: always suggest common-cmds if prefix of cmd Erik Faye-Lund
2010-11-24 19:49           ` Junio C Hamano
2010-11-24 20:20             ` Erik Faye-Lund
2010-11-24 23:53               ` Erik Faye-Lund
2010-11-25  4:49               ` Junio C Hamano
2010-11-25 10:39                 ` Erik Faye-Lund
2010-11-26 16:00                   ` [PATCH v3] " Erik Faye-Lund
2010-11-27  0:18                     ` Junio C Hamano
2010-11-29 11:20                       ` Erik Faye-Lund
2010-11-29 16:40                         ` Jonathan Nieder
2010-11-29 16:53                           ` Erik Faye-Lund
2010-11-29 17:44                         ` Junio C Hamano
2010-12-01 14:33                           ` Erik Faye-Lund
2018-11-19 20:35                     ` help.autoCorrect prefix selection considered a bit dangerous Ævar Arnfjörð Bjarmason
2018-11-20  3:23                       ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=AANLkTinu+Wq84x2H0vB3rUSXbwreumrDC7k2dr5nOfjC@mail.gmail.com \
    --to=kusmabite@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ziade.tarek@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).