mirror of
https://github.com/git/git.git
synced 2024-11-01 06:47:52 +01:00
8af84dadb1
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>
8 lines
201 B
C
8 lines
201 B
C
#ifndef LEVENSHTEIN_H
|
|
#define LEVENSHTEIN_H
|
|
|
|
int levenshtein(const char *string1, const char *string2,
|
|
int swap_penalty, int substition_penalty,
|
|
int insertion_penalty, int deletion_penalty);
|
|
|
|
#endif
|