diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2008-08-31 15:50:23 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-31 10:14:58 -0700 |
commit | 8af84dadb142f7321ff0ce8690385e99da8ede2f (patch) | |
tree | e47023679099de35b18da39c3b1c89efc0dd2c3a /Makefile | |
parent | Merge branch 'mv/merge-custom' (diff) | |
download | tgif-8af84dadb142f7321ff0ce8690385e99da8ede2f.tar.xz |
git wrapper: DWIM mistyped commands
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?
am
rm
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 <johannes.schindelin@gmx.de>
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -358,6 +358,7 @@ LIB_H += graph.h LIB_H += grep.h LIB_H += hash.h LIB_H += help.h +LIB_H += levenshtein.h LIB_H += list-objects.h LIB_H += ll-merge.h LIB_H += log-tree.h @@ -433,6 +434,7 @@ LIB_OBJS += hash.o LIB_OBJS += help.o LIB_OBJS += ident.o LIB_OBJS += interpolate.o +LIB_OBJS += levenshtein.o LIB_OBJS += list-objects.o LIB_OBJS += ll-merge.o LIB_OBJS += lockfile.o |