{"thread":{"id":"13807","subject":"[TOY PATCH] git wrapper: show similar command names for an unknown command","startedAt":"2008-06-05T06:48:40Z","lastAt":"2008-06-08T23:26:36Z","messageCount":28,"participants":["Johannes Schindelin","Teemu Likonen","Sverre Rabbelier","Junio C Hamano","Pieter de Bie","Wincent Colaiuta","Dirk Süsserott","David Symonds","Robin Rosenberg","Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"78708","messageId":"alpine.DEB.1.00.0806050747000.21190@racer","threadId":"13807","inReplyTo":null,"subject":"[TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-05T06:48:40Z","receivedAt":"2008-06-05T06:48:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis patch introduces a modified Damerau-Levenshtein algorithm into\nGit's code base, and uses it with the following penalties to show some\nsimilar commands when an unknown command was encountered:\n\n\tswap = 0, insertion = 1, substitution = 2, deletion = 4\n\nA typical output would now look like this:\n\n\t$ git reabse\n\tgit: 'reabse' is not a git-command. See 'git --help'.\n\n\tDid you mean one of these?\n\t\trebase\n\t\tmerge-base\n\t\trev-parse\n\t\tremote\n\t\trerere\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tThis is just a toy, but might be useful to other people.\n\n Makefile      |    2 ++\n help.c        |   43 +++++++++++++++++++++++++++++++++++++++++++\n levenshtein.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n levenshtein.h |    8 ++++++++\n 4 files changed, 100 insertions(+), 0 deletions(-)\n create mode 100644 levenshtein.c\n create mode 100644 levenshtein.h\n\ndiff --git a/Makefile b/Makefile\nindex cce5a6e..df48af2 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -376,6 +376,7 @@ LIB_H += tree-walk.h\n LIB_H += unpack-trees.h\n LIB_H += utf8.h\n LIB_H += wt-status.h\n+LIB_H += levenshtein.h\n \n LIB_OBJS += alias.o\n LIB_OBJS += alloc.o\n@@ -471,6 +472,7 @@ LIB_OBJS += write_or_die.o\n LIB_OBJS += ws.o\n LIB_OBJS += wt-status.o\n LIB_OBJS += xdiff-interface.o\n+LIB_OBJS += levenshtein.o\n \n BUILTIN_OBJS += builtin-add.o\n BUILTIN_OBJS += builtin-annotate.o\ndiff --git a/help.c b/help.c\nindex d89d437..ac29225 100644\n--- a/help.c\n+++ b/help.c\n@@ -9,6 +9,7 @@\n #include \"common-cmds.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\n+#include \"levenshtein.h\"\n \n static struct man_viewer_list {\n \tstruct man_viewer_list *next;\n@@ -623,9 +624,51 @@ static void show_html_page(const char *git_cmd)\n \texecl_git_cmd(\"web--browse\", \"-c\", \"help.browser\", page_path.buf, NULL);\n }\n \n+static const char *levenshtein_cmd;\n+static int similarity(const char *cmd) {\n+\treturn levenshtein(levenshtein_cmd, cmd, 0, 2, 1, 4);\n+}\n+\n+static int levenshtein_compare(const void *p1, const void *p2)\n+{\n+\tconst struct cmdname *const *c1 = p1, *const *c2 = p2;\n+\tconst char *s1 = (*c1)->name, *s2 = (*c2)->name;\n+\tint l1 = similarity(s1);\n+\tint l2 = similarity(s2);\n+\treturn l1 != l2 ? l1 - l2 : strcmp(s1, s2);\n+}\n+\n void help_unknown_cmd(const char *cmd)\n {\n+\tint i, header_shown = 0;\n+\n \tfprintf(stderr, \"git: '%s' is not a git-command. See 'git --help'.\\n\", cmd);\n+\n+\tload_command_list();\n+\tALLOC_GROW(main_cmds.names, main_cmds.cnt + other_cmds.cnt,\n+\t\t\tmain_cmds.alloc);\n+\tmemcpy(main_cmds.names + main_cmds.cnt, other_cmds.names,\n+\t\tother_cmds.cnt * sizeof(other_cmds.names[0]));\n+\tmain_cmds.cnt += other_cmds.cnt;\n+\n+\tlevenshtein_cmd = cmd;\n+\tqsort(main_cmds.names, main_cmds.cnt,\n+\t      sizeof(*main_cmds.names), levenshtein_compare);\n+\n+\tfor (i = 0; i < main_cmds.cnt; i++) {\n+\t\tint s = similarity(main_cmds.names[i]->name);\n+\t\tif (s > 6)\n+\t\t\tbreak;\n+\t\tif (!i) {\n+\t\t\tfprintf(stderr, \"\\nDid you mean %s?\\n\",\n+\t\t\t\tmain_cmds.cnt < 2 ||\n+\t\t\t\tsimilarity(main_cmds.names[1]->name) > 6 ?\n+\t\t\t\t\"this\" : \"one of these\");\n+\t\t\theader_shown = 1;\n+\t\t}\n+\t\tfprintf(stderr, \"\\t%s\\n\", main_cmds.names[i]->name);\n+\t}\n+\n \texit(1);\n }\n \ndiff --git a/levenshtein.c b/levenshtein.c\nnew file mode 100644\nindex 0000000..db52f2c\n--- /dev/null\n+++ b/levenshtein.c\n@@ -0,0 +1,47 @@\n+#include \"cache.h\"\n+#include \"levenshtein.h\"\n+\n+int levenshtein(const char *string1, const char *string2,\n+\t\tint w, int s, int a, int d)\n+{\n+\tint len1 = strlen(string1), len2 = strlen(string2);\n+\tint *row0 = xmalloc(sizeof(int) * (len2 + 1));\n+\tint *row1 = xmalloc(sizeof(int) * (len2 + 1));\n+\tint *row2 = xmalloc(sizeof(int) * (len2 + 1));\n+\tint i, j;\n+\n+\tfor (j = 0; j <= len2; j++)\n+\t\trow1[j] = j * a;\n+\tfor (i = 0; i < len1; i++) {\n+\t\tint *dummy;\n+\n+\t\trow2[0] = (i + 1) * d;\n+\t\tfor (j = 0; j < len2; j++) {\n+\t\t\t/* substitution */\n+\t\t\trow2[j + 1] = row1[j] + s * (string1[i] != string2[j]);\n+\t\t\t/* swap */\n+\t\t\tif (i > 0 && j > 0 && string1[i - 1] == string2[j] &&\n+\t\t\t\t\tstring1[i] == string2[j - 1] &&\n+\t\t\t\t\trow2[j + 1] > row0[j - 1] + w)\n+\t\t\t\trow2[j + 1] = row0[j - 1] + w;\n+\t\t\t/* deletion */\n+\t\t\tif (j + 1 < len2 && row2[j + 1] > row1[j + 1] + d)\n+\t\t\t\trow2[j + 1] = row1[j + 1] + d;\n+\t\t\t/* insertion */\n+\t\t\tif (row2[j + 1] > row2[j] + a)\n+\t\t\t\trow2[j + 1] = row2[j] + a;\n+\t\t}\n+\n+\t\tdummy = row0;\n+\t\trow0 = row1;\n+\t\trow1 = row2;\n+\t\trow2 = dummy;\n+\t}\n+\n+\ti = row1[len2];\n+\tfree(row0);\n+\tfree(row1);\n+\tfree(row2);\n+\n+\treturn i;\n+}\ndiff --git a/levenshtein.h b/levenshtein.h\nnew file mode 100644\nindex 0000000..0173abe\n--- /dev/null\n+++ b/levenshtein.h\n@@ -0,0 +1,8 @@\n+#ifndef LEVENSHTEIN_H\n+#define LEVENSHTEIN_H\n+\n+int levenshtein(const char *string1, const char *string2,\n+\tint swap_penalty, int substition_penalty,\n+\tint insertion_penalty, int deletion_penalty);\n+\n+#endif\n-- \n1.5.6.rc1.167.gce972\n"},{"id":"78720","messageId":"20080605081911.GA5946@mithlond.arda.local","threadId":"13807","inReplyTo":"alpine.DEB.1.00.0806050747000.21190@racer","subject":"[PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-06-05T08:19:11Z","receivedAt":"2008-06-05T08:19:11Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Johannes Schindelin wrote (2008-06-05 07:48 +0100):\n\n> A typical output would now look like this:\n> \n> \t$ git reabse\n> \tgit: 'reabse' is not a git-command. See 'git --help'.\n\nA side note: The following three commands seem to do exactly the same:\n\n  $ git --help log\n  $ git log --help\n  $ git help log\n\nWhich in itself is good, I think, since in all the cases user expects to\nget the manual for \"log\". It seems that \"git help <command>\" is the most\noften advertised in manuals and tutorials but it does not show in the\nlist printed by \"git / git --help / git help\":\n\n  $ git\n  usage: [...]\n\n  The most commonly used git commands are:\n  [There's no \"help\" command in the list.]\n\nI think it belongs there, so how about the following patch? There are\ntwo logically separate changes but I didn't feel that they deserve\nseparate commits.\n\n---snip---\nAdd subcommand \"help\" to the list of most commonly used subcommands\n\nCommands \"git\", \"git --help\" and \"git help\" did not list the subcommand\n\"help\" as one of the most commonly used git commands. Yet \"git help\" is\nadvertised as the help command of git so this patch adds \"help\" the\nlist.\n\nIn addition to that change the short description in git-help.txt manual\nto start with a capital letter.\n\nSigned-off-by: Teemu Likonen <tlikonen@iki.fi>\n---\n Documentation/git-help.txt |    2 +-\n command-list.txt           |    2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-help.txt b/Documentation/git-help.txt\nindex bfbba9e..4d3613c 100644\n--- a/Documentation/git-help.txt\n+++ b/Documentation/git-help.txt\n@@ -3,7 +3,7 @@ git-help(1)\n \n NAME\n ----\n-git-help - display help information about git\n+git-help - Display help information about git\n \n SYNOPSIS\n --------\ndiff --git a/command-list.txt b/command-list.txt\nindex 3583a33..510ac69 100644\n--- a/command-list.txt\n+++ b/command-list.txt\n@@ -47,7 +47,7 @@ git-get-tar-commit-id                   ancillaryinterrogators\n git-grep                                mainporcelain common\n git-gui                                 mainporcelain\n git-hash-object                         plumbingmanipulators\n-git-help\t\t\t\tancillaryinterrogators\n+git-help\t\t\t\tancillaryinterrogators common\n git-http-fetch                          synchelpers\n git-http-push                           synchelpers\n git-imap-send                           foreignscminterface\n-- \n1.5.6.rc1.15.gc0c85\n"},{"id":"78738","messageId":"alpine.DEB.1.00.0806051131310.21190@racer","threadId":"13807","inReplyTo":"20080605081911.GA5946@mithlond.arda.local","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-05T10:32:10Z","receivedAt":"2008-06-05T10:32:10Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 5 Jun 2008, Teemu Likonen wrote:\n\n> Add subcommand \"help\" to the list of most commonly used subcommands\n\nHrmpf.  IMO \"help\" is not really a _git_ command.  And I use it really, \nreally rarely.\n\nCiao,\nDscho\n"},{"id":"78740","messageId":"20080605105204.GA17979@mithlond.arda.local","threadId":"13807","inReplyTo":"alpine.DEB.1.00.0806051131310.21190@racer","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-06-05T10:52:04Z","receivedAt":"2008-06-05T10:52:04Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Johannes Schindelin wrote (2008-06-05 11:32 +0100):\n\n> On Thu, 5 Jun 2008, Teemu Likonen wrote:\n> \n> > Add subcommand \"help\" to the list of most commonly used subcommands\n> \n> Hrmpf.  IMO \"help\" is not really a _git_ command.  And I use it\n> really, really rarely.\n\nBut you know git inside out, don't you? It seems common to have such\nhelp command: svn help, bzr help, hg help. They all list \"help\" as one\nof the subcommands. I don't know anything about \"being really a git\ncommand\" but from user interface's point of view \"git help\" is a git\ncommand. It's even advertised in output of other git commands (well, at\nleast \"git gc --auto\").\n\nAnyway, I'd change the short description of \"git help\" to be more\ninformative so I'd separate the changes. Version 2 follows.\n"},{"id":"78743","messageId":"1212663425-20064-1-git-send-email-tlikonen@iki.fi","threadId":"13807","inReplyTo":"20080605105204.GA17979@mithlond.arda.local","subject":"[PATCH v2 1/2] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-06-05T10:57:04Z","receivedAt":"2008-06-05T10:57:04Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Commands \"git\", \"git --help\" and \"git help\" did not list the subcommand\n\"help\" as one of the most commonly used git commands. Yet \"git help\" is\nadvertised as the help command of git so this patch adds \"help\" the\nlist.\n\nSigned-off-by: Teemu Likonen <tlikonen@iki.fi>\n---\n command-list.txt |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/command-list.txt b/command-list.txt\nindex 3583a33..510ac69 100644\n--- a/command-list.txt\n+++ b/command-list.txt\n@@ -47,7 +47,7 @@ git-get-tar-commit-id                   ancillaryinterrogators\n git-grep                                mainporcelain common\n git-gui                                 mainporcelain\n git-hash-object                         plumbingmanipulators\n-git-help\t\t\t\tancillaryinterrogators\n+git-help\t\t\t\tancillaryinterrogators common\n git-http-fetch                          synchelpers\n git-http-push                           synchelpers\n git-imap-send                           foreignscminterface\n-- \n1.5.6.rc1.17.gfc76f\n"},{"id":"78742","messageId":"1212663425-20064-2-git-send-email-tlikonen@iki.fi","threadId":"13807","inReplyTo":"1212663425-20064-1-git-send-email-tlikonen@iki.fi","subject":"[PATCH v2 2/2] More informative short description for git-help.txt","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-06-05T10:57:05Z","receivedAt":"2008-06-05T10:57:05Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Signed-off-by: Teemu Likonen <tlikonen@iki.fi>\n---\n Documentation/git-help.txt |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-help.txt b/Documentation/git-help.txt\nindex bfbba9e..4df3791 100644\n--- a/Documentation/git-help.txt\n+++ b/Documentation/git-help.txt\n@@ -3,7 +3,7 @@ git-help(1)\n \n NAME\n ----\n-git-help - display help information about git\n+git-help - Display help information about git commands and other topics\n \n SYNOPSIS\n --------\n-- \n1.5.6.rc1.17.gfc76f\n"},{"id":"78746","messageId":"bd6139dc0806050421l3a242a98sdfa51248b380badc@mail.gmail.com","threadId":"13807","inReplyTo":"alpine.DEB.1.00.0806051131310.21190@racer","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-06-05T11:21:04Z","receivedAt":"2008-06-05T11:21:04Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Thu, Jun 5, 2008 at 12:32 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> On Thu, 5 Jun 2008, Teemu Likonen wrote:\n>> Add subcommand \"help\" to the list of most commonly used subcommands\n>\n> Hrmpf.  IMO \"help\" is not really a _git_ command.  And I use it really,\n> really rarely.\n\nI agree with this, but not because I don't use it rarely, but because\nthere is no such command 'git-help'. I know that we are urging the\nuser away from the dash notation, but if we want to advertise 'git\nhelp' as an actual command, at least make 'git' recognize it as an\nactual command instead of displaying the default usage notice (type\n'git help' and see what I mean).\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"78763","messageId":"alpine.DEB.1.00.0806051356520.21190@racer","threadId":"13807","inReplyTo":"20080605105204.GA17979@mithlond.arda.local","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-05T12:58:31Z","receivedAt":"2008-06-05T12:58:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 5 Jun 2008, Teemu Likonen wrote:\n\n> Johannes Schindelin wrote (2008-06-05 11:32 +0100):\n> \n> > On Thu, 5 Jun 2008, Teemu Likonen wrote:\n> > \n> > > Add subcommand \"help\" to the list of most commonly used subcommands\n> > \n> > Hrmpf.  IMO \"help\" is not really a _git_ command.  And I use it\n> > really, really rarely.\n> \n> But you know git inside out, don't you? It seems common to have such\n> help command: svn help, bzr help, hg help.\n\nOh, I was not talking about how common that command is, but how commonly \nused.\n\nAnd I would be quite annoyed by \"git help\" telling me that there is a \n\"help\" command as well; how does it think I got the list to begin with?  \nOf course I used \"git help\", so I know that command already, and do not \nneed it listed with more interesting commands.\n\nWhatever,\nDscho\n"},{"id":"78767","messageId":"20080605132257.GA30995@mithlond.arda.local","threadId":"13807","inReplyTo":"bd6139dc0806050421l3a242a98sdfa51248b380badc@mail.gmail.com","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-06-05T13:22:57Z","receivedAt":"2008-06-05T13:22:57Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Sverre Rabbelier wrote (2008-06-05 13:21 +0200):\n\n> On Thu, Jun 5, 2008 at 12:32 PM, Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n> > On Thu, 5 Jun 2008, Teemu Likonen wrote:\n> >> Add subcommand \"help\" to the list of most commonly used subcommands\n> >\n> > Hrmpf.  IMO \"help\" is not really a _git_ command.  And I use it\n> > really, really rarely.\n> \n> I agree with this, but not because I don't use it rarely, but because\n> there is no such command 'git-help'. I know that we are urging the\n> user away from the dash notation, but if we want to advertise 'git\n> help' as an actual command, at least make 'git' recognize it as an\n> actual command instead of displaying the default usage notice (type\n> 'git help' and see what I mean).\n\nWell, you guys know the internals, I don't, but I have to admit that\nyour opinions sound weird to me at the moment. I mean, what's the\npurpose of the command list printed after typing just \"git\"? To help\nusers, I'd say. Making help commands/options easily available is for the\nsame purpose. If manuals, mailing lists, web pages, IRC logs and your\ngrandmothers advertise \"git help\" as _the_ help command but at the same\ntime user can't find the command advertised in the git's own \"metahelp\"\npage it's quite confusing.\n\nI came up with this suggestion because of my personal confusion. Command\n\"git\" speaks only about --help option and I was coming to a conclusion\nthat \"git help\" is deprecated and instructions are just out-of-date.\nThen I read the \"git help help\" manual and saw that actually \"git\n--help\" is internally converted to \"git help\" so it's probably not\ndeprecated (quite the opposite actually). And yet the front page printed\nby \"git\" does not show it.\n\nBut ok, here's another suggestion: If \"git help\" is not a real git\ncommand then maybe not list it with other commonly used commands.\nInstead print separate instructions before or after the list. Something\nlike this:\n\n  Type \"git help <command>\" for more information on a specific command\n  or other topic.\n\n\nExamples from other tools:\n\n  $ hg help | grep help\n   help         show help for a command, extension, or list of commands\n  use \"hg -v help\" to show aliases and global options\n  \n  $ bzr help | grep help\n    bzr help init      more help on e.g. init command\n    bzr help commands  list all commands\n    bzr help topics    list all help topics\n  \n  $ svn help | grep help\n  Type 'svn help <subcommand>' for help on a specific subcommand.\n     help (?, h)\n"},{"id":"78790","messageId":"7viqwn3g3r.fsf@gitster.siamese.dyndns.org","threadId":"13807","inReplyTo":"20080605081911.GA5946@mithlond.arda.local","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-05T18:13:12Z","receivedAt":"2008-06-05T18:13:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Teemu Likonen <tlikonen@iki.fi> writes:\n\n>   $ git\n>   usage: [...]\n>\n>   The most commonly used git commands are:\n>   [There's no \"help\" command in the list.]\n>\n> I think it belongs there,...\n\nWhile I do agree that a word 'help' should appear in the above output\nsomewhere, it is a horrible idea to place it in \"list of common commands\"\nfor two reasons.\n\n (1) nobody keeps typing \"git help\".  The reason we may want to mention\n     'help' in this output is not because it is common;\n\n (2) 'help' _is_ different from other commands.  It is something one may\n     want to know the presense of when one is still lost after seeing the\n     above quoted output, especially when one is starting to learn.  It\n     makes it more difficult to spot it if you bury it as one of the\n     commands in a list.\n\nIt is reasonable to mention 'help' somewhere in the output, but if we are\ngoing to do this, we should make it stand out.  Perhaps like this.\n\n-- >8 --\n$ git\nusage: git [--version] ...\n\nThe most commonly used git commands are:\n   add        Add file contents to the index\n   bisect     Find the change that introduced a bug by binary search\n   branch     List, create, or delete branches\n   ...\n   show       Show various types of objects\n   status     Show the working tree status\n   tag        Create, list, delete or verify a tag object signed with GPG\n\nSee 'man git' and 'git help' for more information.\n-- 8< --\n"},{"id":"78792","messageId":"408F1687-FC42-4E96-B641-088F200CE8D1@ai.rug.nl","threadId":"13807","inReplyTo":"7viqwn3g3r.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Pieter de Bie","fromEmail":"pdebie@ai.rug.nl","sentAt":"2008-06-05T18:38:02Z","receivedAt":"2008-06-05T18:38:02Z","isPatch":true,"sender":{"key":"pdebie@ai.rug.nl","avatar":null},"body":"\nOn 5 jun 2008, at 20:13, Junio C Hamano wrote:\n\n> See 'man git' and 'git help' for more information.\n\nI'd like to see something more like\n\nSee 'git help COMMAND' for more information on a specific command\n\n\n- Pieter\n"},{"id":"78796","messageId":"F9BB4443-EDCA-4941-9852-B84535DAD097@wincent.com","threadId":"13807","inReplyTo":"7viqwn3g3r.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-06-05T18:42:40Z","receivedAt":"2008-06-05T18:42:40Z","isPatch":true,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"\nEl 5/6/2008, a las 20:13, Junio C Hamano escribió:\n\n> It is reasonable to mention 'help' somewhere in the output, but if  \n> we are\n> going to do this, we should make it stand out.  Perhaps like this.\n>\n> -- >8 --\n> $ git\n> usage: git [--version] ...\n>\n> The most commonly used git commands are:\n>   add        Add file contents to the index\n>   bisect     Find the change that introduced a bug by binary search\n>   branch     List, create, or delete branches\n>   ...\n>   show       Show various types of objects\n>   status     Show the working tree status\n>   tag        Create, list, delete or verify a tag object signed with  \n> GPG\n>\n> See 'man git' and 'git help' for more information.\n> -- 8< --\n\nBut if the user types \"git help\" they'll be presented with the exact  \nsame list of common commands again, at which point they'll probably  \nwonder why Git suggested that.\n\nFunnily enough, if they type \"git help help\" then they'll get the \"git- \nhelp\" man page. So, there is no command called \"git-help\" on the  \nsystem, but from the user's perspective it walks, talks and quacks  \nlike all the \"real\" commands, and so they probably consider it to be  \none. Whether or not the \"help\" subcommand corresponds to a real  \nexecutable or script is really just an implementation detail, I think.\n\nHaving said that, I think your suggestion is sound if it were reworded  \nas:\n\n   See 'man git' and 'git help [command]' for more information.\n\nCheers,\nWincent\n"},{"id":"78801","messageId":"bd6139dc0806051215i3e1f1aecg26a4baa358504849@mail.gmail.com","threadId":"13807","inReplyTo":"F9BB4443-EDCA-4941-9852-B84535DAD097@wincent.com","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-06-05T19:15:53Z","receivedAt":"2008-06-05T19:15:53Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Thu, Jun 5, 2008 at 8:42 PM, Wincent Colaiuta <win@wincent.com> wrote:\n\n> But if the user types \"git help\" they'll be presented with the exact same\n> list of common commands again, at which point they'll probably wonder why\n> Git suggested that.\n\nThis is exactly what I meant with my earlier comment.\n\n> Funnily enough, if they type \"git help help\" then they'll get the \"git-help\"\n> man page. So, there is no command called \"git-help\" on the system, but from\n> the user's perspective it walks, talks and quacks like all the \"real\"\n> commands, and so they probably consider it to be one. Whether or not the\n> \"help\" subcommand corresponds to a real executable or script is really just\n> an implementation detail, I think.\n\nI fully agree here, it doesn't matter if there is a 'git-help.sh' or\n'git-help' executable, as long as from the users POV there is a 'git\nhelp' command should we advertise it.\n\n> Having said that, I think your suggestion is sound if it were reworded as:\n>\n>  See 'man git' and 'git help [command]' for more information.\n\nThat would be good, since it does not advertise a git help command,\ninstead it advertises 'git help command', which clearly -is- a command\n(since typing 'git help command' brings up a man page).\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"78822","messageId":"484853B1.80509@dirk.my1.cc","threadId":"13807","inReplyTo":"alpine.DEB.1.00.0806050747000.21190@racer","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2008-06-05T20:59:29Z","receivedAt":"2008-06-05T20:59:29Z","isPatch":true,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Johannes Schindelin schrieb:\n> This patch introduces a modified Damerau-Levenshtein algorithm into\n> Git's code base, and uses it with the following penalties to show some\n> similar commands when an unknown command was encountered:\n>\n> \tswap = 0, insertion = 1, substitution = 2, deletion = 4\n>\n> A typical output would now look like this:\n>\n> \t$ git reabse\n> \tgit: 'reabse' is not a git-command. See 'git --help'.\n>\n> \tDid you mean one of these?\n> \t\trebase\n> \t\tmerge-base\n> \t\trev-parse\n> \t\tremote\n> \t\trerere\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n> \tThis is just a toy, but might be useful to other people.\n>\n>   \n[snip]\n\nWhow! This is really cool, especially for people that do not know the\ndifferent commands by heart -- like me. I often know there's a\ncommand that's spelled somehow like X but I don't exactly remember.\nYour patch seems perfect for that situation. :-)\nKeen on seeing it in a future release. Thanks in advance. Did someone\nsuggest it or was it your very own idea?\n\n    -- Dirk\n"},{"id":"78825","messageId":"20080605211536.GA4328@mithlond.arda.local","threadId":"13807","inReplyTo":"408F1687-FC42-4E96-B641-088F200CE8D1@ai.rug.nl","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-06-05T21:15:36Z","receivedAt":"2008-06-05T21:15:36Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Pieter de Bie wrote (2008-06-05 20:38 +0200):\n\n> On 5 jun 2008, at 20:13, Junio C Hamano wrote:\n> \n> >See 'man git' and 'git help' for more information.\n> \n> I'd like to see something more like\n> \n> See 'git help COMMAND' for more information on a specific command\n\nSounds good. Here comes my first _ever_ attempt on C \"programming\". It\nimplements (i.e. tries to) what pretty much seems like an agreement on\nthe list: a separate info line after the command list. If the patch\nsucks, well, at least I've had fun trying. And there's no need to ask me\nto defend my code; I'm not able to answer. :-)\n\n---snip---\nPrint info about \"git help COMMAND\" on git's main usage pages\n\nGit's main usage pages did not show \"git help\" as a way to get more\ninformation on a specific subcommand. This patch adds an info line after\nthe list of git commands currently printed by \"git\", \"git help\", \"git\n--help\" and \"git help --all\".\n\nSigned-off-by: Teemu Likonen <tlikonen@iki.fi>\n---\n builtin.h |    1 +\n git.c     |    4 ++++\n help.c    |    2 ++\n 3 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin.h b/builtin.h\nindex 8bda111..b460b2d 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -5,6 +5,7 @@\n \n extern const char git_version_string[];\n extern const char git_usage_string[];\n+extern const char git_more_info_string[];\n \n extern void list_common_cmds_help(void);\n extern void help_unknown_cmd(const char *cmd);\ndiff --git a/git.c b/git.c\nindex 272bf03..15a0e71 100644\n--- a/git.c\n+++ b/git.c\n@@ -6,6 +6,9 @@\n const char git_usage_string[] =\n \t\"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]\";\n \n+const char git_more_info_string[] =\n+\t\"See 'git help COMMAND' for more information on a specific command.\";\n+\n static int handle_options(const char*** argv, int* argc, int* envchanged)\n {\n \tint handled = 0;\n@@ -427,6 +430,7 @@ int main(int argc, const char **argv)\n \t\t/* The user didn't specify a command; give them help */\n \t\tprintf(\"usage: %s\\n\\n\", git_usage_string);\n \t\tlist_common_cmds_help();\n+\t\tprintf(\"\\n%s\\n\", git_more_info_string);\n \t\texit(1);\n \t}\n \tcmd = argv[0];\ndiff --git a/help.c b/help.c\nindex d89d437..8aff94c 100644\n--- a/help.c\n+++ b/help.c\n@@ -649,12 +649,14 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \tif (show_all) {\n \t\tprintf(\"usage: %s\\n\\n\", git_usage_string);\n \t\tlist_commands();\n+\t\tprintf(\"%s\\n\", git_more_info_string);\n \t\treturn 0;\n \t}\n \n \tif (!argv[0]) {\n \t\tprintf(\"usage: %s\\n\\n\", git_usage_string);\n \t\tlist_common_cmds_help();\n+\t\tprintf(\"\\n%s\\n\", git_more_info_string);\n \t\treturn 0;\n \t}\n \n-- \n1.5.6.rc1.16.gc6796\n"},{"id":"78826","messageId":"7v63sn1t0j.fsf@gitster.siamese.dyndns.org","threadId":"13807","inReplyTo":"408F1687-FC42-4E96-B641-088F200CE8D1@ai.rug.nl","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-05T21:17:16Z","receivedAt":"2008-06-05T21:17:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pieter de Bie <pdebie@ai.rug.nl> writes:\n\n> On 5 jun 2008, at 20:13, Junio C Hamano wrote:\n>\n>> See 'man git' and 'git help' for more information.\n>\n> I'd like to see something more like\n>\n> See 'git help COMMAND' for more information on a specific command\n\nYeah, I think that is so far the best color of the shed I suggested\n\"Perhaps like this\".\n"},{"id":"78833","messageId":"alpine.DEB.1.00.0806052358580.21190@racer","threadId":"13807","inReplyTo":"484853B1.80509@dirk.my1.cc","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-05T23:00:55Z","receivedAt":"2008-06-05T23:00:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 5 Jun 2008, Dirk Süsserott wrote:\n\n> This is really cool, especially for people that do not know the \n> different commands by heart -- like me. I often know there's a command \n> that's spelled somehow like X but I don't exactly remember. Your patch \n> seems perfect for that situation. :-)\n\nHeh.\n\n> Keen on seeing it in a future release. Thanks in advance. Did someone \n> suggest it or was it your very own idea?\n\nMaybe someone suggested it in the past.  It just happened that I wanted to \nprocrastinate, and levenshtein.c in my personal fork came before my eyes.  \nThis was the next best thing I could think of doing with it.\n\nIn the course I realized that my extension to take swaps into account was \nalready known as the Damerau-Levenshtein distance, so I even learnt \nsomething in the process ;-)\n\nCiao,\nDscho\n"},{"id":"78863","messageId":"ee77f5c20806052211q6aca39t37d423aa978e098a@mail.gmail.com","threadId":"13807","inReplyTo":"7v63sn1t0j.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add subcommand \"help\" to the list of most commonly used subcommands","fromName":"David Symonds","fromEmail":"dsymonds@gmail.com","sentAt":"2008-06-06T05:11:58Z","receivedAt":"2008-06-06T05:11:58Z","isPatch":true,"sender":{"key":"dsymonds@gmail.com","avatar":"https://gravatar.com/avatar/b22f5051cbfc11836e36cf7a690e6cde4e225d835e13295ff98d15c7a9ee3c0f?d=mp&s=160"},"body":"On Fri, Jun 6, 2008 at 7:17 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Pieter de Bie <pdebie@ai.rug.nl> writes:\n>\n>> On 5 jun 2008, at 20:13, Junio C Hamano wrote:\n>>\n>>> See 'man git' and 'git help' for more information.\n>>\n>> I'd like to see something more like\n>>\n>> See 'git help COMMAND' for more information on a specific command\n>\n> Yeah, I think that is so far the best color of the shed I suggested\n> \"Perhaps like this\".\n\nI think mauve has the most RAM.\n\n\nDave.\n"},{"id":"78893","messageId":"200806061415.27507.robin.rosenberg.lists@dewire.com","threadId":"13807","inReplyTo":"alpine.DEB.1.00.0806050747000.21190@racer","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-06-06T12:15:27Z","receivedAt":"2008-06-06T12:15:27Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"torsdagen den 5 juni 2008 08.48.40 skrev Johannes Schindelin:\n> \n> This patch introduces a modified Damerau-Levenshtein algorithm into\n> Git's code base, and uses it with the following penalties to show some\n> similar commands when an unknown command was encountered:\n> \n> \tswap = 0, insertion = 1, substitution = 2, deletion = 4\n> \n> A typical output would now look like this:\n> \n> \t$ git reabse\n> \tgit: 'reabse' is not a git-command. See 'git --help'.\n> \n> \tDid you mean one of these?\n> \t\trebase\n> \t\tmerge-base\n> \t\trev-parse\n> \t\tremote\n> \t\trerere\n> \nSorry about my negativity here..\n\nDoesn't this confuse more than it helps? Most people do not need to know about rerere, rev-parse or merge-base so it is very unlikely they actually meant those. That might be an issue of tuning than general principles, but I have my doubts. It won't hint that there are wildly different variants of rebase, which ctually might be much more important to know than rerere, not will it tell svn users that git revert isn't even close to svn revert.\n\nCompletion or git gui is a much better tool for solving this isssue\n\nSome ancient LISP had a DWIM (do what I mean) and there might be a reason it has not become ery popular.\n\nDespite not being useful, it's still cool :)\n\n-- robin\n"},{"id":"78915","messageId":"FFFBD901-955E-472F-BFAC-E11D69934064@wincent.com","threadId":"13807","inReplyTo":"200806061415.27507.robin.rosenberg.lists@dewire.com","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-06-06T14:18:09Z","receivedAt":"2008-06-06T14:18:09Z","isPatch":true,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 6/6/2008, a las 14:15, Robin Rosenberg escribió:\n\n> torsdagen den 5 juni 2008 08.48.40 skrev Johannes Schindelin:\n>>\n>> This patch introduces a modified Damerau-Levenshtein algorithm into\n>> Git's code base, and uses it with the following penalties to show  \n>> some\n>> similar commands when an unknown command was encountered:\n>>\n>> \tswap = 0, insertion = 1, substitution = 2, deletion = 4\n>>\n>> A typical output would now look like this:\n>>\n>> \t$ git reabse\n>> \tgit: 'reabse' is not a git-command. See 'git --help'.\n>>\n>> \tDid you mean one of these?\n>> \t\trebase\n>> \t\tmerge-base\n>> \t\trev-parse\n>> \t\tremote\n>> \t\trerere\n>>\n> Sorry about my negativity here..\n>\n> Doesn't this confuse more than it helps? Most people do not need to  \n> know about rerere, rev-parse or merge-base so it is very unlikely  \n> they actually meant those. That might be an issue of tuning than  \n> general principles, but I have my doubts. It won't hint that there  \n> are wildly different variants of rebase, which ctually might be much  \n> more important to know than rerere, not will it tell svn users that  \n> git revert isn't even close to svn revert.\n>\n> Completion or git gui is a much better tool for solving this isssue\n\nAll true, but most of those issues would go away if just _one_ guess,  \nthe best guess, was shown.\n\nCheers,\nWincent\n"},{"id":"79023","messageId":"20080607072721.GA3347@steel.home","threadId":"13807","inReplyTo":"alpine.DEB.1.00.0806050747000.21190@racer","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-06-07T07:27:21Z","receivedAt":"2008-06-07T07:27:21Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Johannes Schindelin, Thu, Jun 05, 2008 08:48:40 +0200:\n> A typical output would now look like this:\n> \n> \t$ git reabse\n> \tgit: 'reabse' is not a git-command. See 'git --help'.\n> \n> \tDid you mean one of these?\n> \t\trebase\n> \t\tmerge-base\n> \t\trev-parse\n> \t\tremote\n> \t\trerere\n> \n\nThat's really cool :) And I find it useful (and already applied it to\nmy tree). For me, it works like a simple reminder about what I was\nabout to do. Helps when working on many things at the same time\n(typical typo: mrge. And your patch shows it as the first hit).\n\nBTW, you probably want to restrict the number of lines output.\nFor instance, \"git ma\" (am, printed correctly in the first line)\nlists around 30 commands, which scrolls clear a 25 line terminal\nand is a lot of output anyway. I tried it with at most 5 hints:\n\ndiff --git a/help.c b/help.c\nindex ac29225..765eed8 100644\n--- a/help.c\n+++ b/help.c\n@@ -640,7 +640,7 @@ static int levenshtein_compare(const void *p1, const void *p2)\n \n void help_unknown_cmd(const char *cmd)\n {\n-\tint i, header_shown = 0;\n+\tint i, header_shown = 0, listed = 0;\n \n \tfprintf(stderr, \"git: '%s' is not a git-command. See 'git --help'.\\n\", cmd);\n \n@@ -667,6 +667,8 @@ void help_unknown_cmd(const char *cmd)\n \t\t\theader_shown = 1;\n \t\t}\n \t\tfprintf(stderr, \"\\t%s\\n\", main_cmds.names[i]->name);\n+\t\tif (++listed >= 5)\n+\t\t\tbreak;\n \t}\n \n \texit(1);\n"},{"id":"79044","messageId":"alpine.DEB.1.00.0806071603470.1783@racer","threadId":"13807","inReplyTo":"20080607072721.GA3347@steel.home","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-07T15:04:14Z","receivedAt":"2008-06-07T15:04:14Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 7 Jun 2008, Alex Riesen wrote:\n\n\n> diff --git a/help.c b/help.c\n> index ac29225..765eed8 100644\n> --- a/help.c\n> +++ b/help.c\n> @@ -640,7 +640,7 @@ static int levenshtein_compare(const void *p1, const void *p2)\n>  \n>  void help_unknown_cmd(const char *cmd)\n>  {\n> -\tint i, header_shown = 0;\n> +\tint i, header_shown = 0, listed = 0;\n>  \n>  \tfprintf(stderr, \"git: '%s' is not a git-command. See 'git --help'.\\n\", cmd);\n>  \n> @@ -667,6 +667,8 @@ void help_unknown_cmd(const char *cmd)\n>  \t\t\theader_shown = 1;\n>  \t\t}\n>  \t\tfprintf(stderr, \"\\t%s\\n\", main_cmds.names[i]->name);\n> +\t\tif (++listed >= 5)\n> +\t\t\tbreak;\n>  \t}\n>  \n>  \texit(1);\n\nHow about this instead?\n\n-- snipsnap --\n\n help.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/help.c b/help.c\nindex bd51852..173e502 100644\n--- a/help.c\n+++ b/help.c\n@@ -655,7 +655,7 @@ void help_unknown_cmd(const char *cmd)\n \tqsort(main_cmds.names, main_cmds.cnt,\n \t      sizeof(*main_cmds.names), levenshtein_compare);\n \n-\tfor (i = 0; i < main_cmds.cnt; i++) {\n+\tfor (i = 0; i < main_cmds.cnt && i < 5; i++) {\n \t\tint s = similarity(main_cmds.names[i]->name);\n \t\tif (s > 6)\n \t\t\tbreak;\n"},{"id":"79062","messageId":"20080607175103.GA5822@steel.home","threadId":"13807","inReplyTo":"alpine.DEB.1.00.0806071603470.1783@racer","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-06-07T17:51:03Z","receivedAt":"2008-06-07T17:51:03Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Johannes Schindelin, Sat, Jun 07, 2008 17:04:14 +0200:\n> -\tfor (i = 0; i < main_cmds.cnt; i++) {\n> +\tfor (i = 0; i < main_cmds.cnt && i < 5; i++) {\n\nI accidentally considered \"i\" just the index in the global command\ntable. Of course it is better :)\n"},{"id":"79063","messageId":"7vmylxnmnz.fsf@gitster.siamese.dyndns.org","threadId":"13807","inReplyTo":"20080607175103.GA5822@steel.home","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-07T18:08:00Z","receivedAt":"2008-06-07T18:08:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> Johannes Schindelin, Sat, Jun 07, 2008 17:04:14 +0200:\n>> -\tfor (i = 0; i < main_cmds.cnt; i++) {\n>> +\tfor (i = 0; i < main_cmds.cnt && i < 5; i++) {\n>\n> I accidentally considered \"i\" just the index in the global command\n> table. Of course it is better :)\n\nThat confusion however shows how hacky the approach to clobber the\nmain_cmds global table by stuffing other things in it and sorting, without\nsaying \"who cares, we will exit after we are done with this processing\nanyway\".  If this patch were for inclusion, such a comment should be there\nimmediately before it starts to muck with the command table.\n"},{"id":"79118","messageId":"alpine.DEB.1.00.0806081607040.1783@racer","threadId":"13807","inReplyTo":"7vmylxnmnz.fsf@gitster.siamese.dyndns.org","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-08T15:07:23Z","receivedAt":"2008-06-08T15:07:23Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 7 Jun 2008, Junio C Hamano wrote:\n\n> Alex Riesen <raa.lkml@gmail.com> writes:\n> \n> > Johannes Schindelin, Sat, Jun 07, 2008 17:04:14 +0200:\n> >> -\tfor (i = 0; i < main_cmds.cnt; i++) {\n> >> +\tfor (i = 0; i < main_cmds.cnt && i < 5; i++) {\n> >\n> > I accidentally considered \"i\" just the index in the global command\n> > table. Of course it is better :)\n> \n> That confusion however shows how hacky the approach to clobber the \n> main_cmds global table by stuffing other things in it and sorting, \n> without saying \"who cares, we will exit after we are done with this \n> processing anyway\".  If this patch were for inclusion, such a comment \n> should be there immediately before it starts to muck with the command \n> table.\n\nThis patch is not meant for inclusion, as indicated by the \"TOY PATCH\" \nprefix.\n\nCiao,\nDscho\n"},{"id":"79119","messageId":"484BF751.1000203@dirk.my1.cc","threadId":"13807","inReplyTo":"alpine.DEB.1.00.0806081607040.1783@racer","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2008-06-08T15:14:25Z","receivedAt":"2008-06-08T15:14:25Z","isPatch":true,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Johannes Schindelin schrieb:\n> This patch is not meant for inclusion, as indicated by the \"TOY PATCH\" \n> prefix.\n>   \nWhat a pity! :-( I liked it.\n"},{"id":"79141","messageId":"7vskvnke34.fsf@gitster.siamese.dyndns.org","threadId":"13807","inReplyTo":"484BF751.1000203@dirk.my1.cc","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-08T17:53:51Z","receivedAt":"2008-06-08T17:53:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dirk Süsserott <newsletter@dirk.my1.cc> writes:\n\n> Johannes Schindelin schrieb:\n>> This patch is not meant for inclusion, as indicated by the \"TOY\n>> PATCH\" prefix.\n\nYes, I understand it.\n\nI was not complaining about the \"who cares, we will exit after we are done\nwith this processing anyway\" attitude in this code.  I think it is a\nreasonable approach to take because it is not likely that this codepath to\nchange and would start wanting to access the original command table after\nit did its munging.  I was suggesting a positive improvement to the patch\nby making it explicitly documented to help people polish further, that's\nall.  You do not have to be so defensive.\n\n> What a pity! :-( I liked it.\n\nLikewise.\n"},{"id":"79186","messageId":"alpine.DEB.1.00.0806090024430.1783@racer","threadId":"13807","inReplyTo":"7vskvnke34.fsf@gitster.siamese.dyndns.org","subject":"Re: [TOY PATCH] git wrapper: show similar command names for an unknown command","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-08T23:26:36Z","receivedAt":"2008-06-08T23:26:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 8 Jun 2008, Junio C Hamano wrote:\n\n> Dirk Süsserott <newsletter@dirk.my1.cc> writes:\n> \n> > Johannes Schindelin schrieb:\n> >> This patch is not meant for inclusion, as indicated by the \"TOY\n> >> PATCH\" prefix.\n> \n> Yes, I understand it.\n> \n> I was not complaining about the \"who cares, we will exit after we are \n> done with this processing anyway\" attitude in this code.  I think it is \n> a reasonable approach to take because it is not likely that this \n> codepath to change and would start wanting to access the original \n> command table after it did its munging.  I was suggesting a positive \n> improvement to the patch by making it explicitly documented to help \n> people polish further, that's all.\n\nI understood that.  However, I simply do not have the time to take care of \nthat.  That's why I said it is a toy patch, and I did not mean it for \ninclusion.  It was just a nice time waster for me; it's not even something \nI'd find terribly useful myself, unless it asked me if I wanted to execute \nthis or that instead (provided that isatty()).\n\n> You do not have to be so defensive.\n\nI wasn't.  At least I did not mean to.\n\nCiao,\nDscho\n"}]}