• Johannes Schindelin's avatar
    git wrapper: DWIM mistyped commands · 8af84dad
    Johannes Schindelin authored
    This patch introduces a modified Damerau-Levenshtein algorithm into
    Git's code base, and uses it with the following penalties to show some
    similar commands when an unknown command was encountered:
    	swap = 0, insertion = 1, substitution = 2, deletion = 4
    A typical output would now look like this:
    	$ git sm
    	git: 'sm' is not a git-command. See 'git --help'.
    	Did you mean one of these?
    The cut-off is at similarity rating 6, which was empirically determined
    to give sensible results.
    As a convenience, if there is only one candidate, Git continues under
    the assumption that the user mistyped it.  Example:
    	$ git reabse
    	WARNING: You called a Git program named 'reabse', which does
    	not exist.
    	Continuing under the assumption that you meant 'rebase'
    Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: default avatarAlex Riesen <raa.lkml@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
levenshtein.h 201 Bytes