{"thread":{"id":"20821","subject":"[PATCH] git-completion.bash: prevent 'git help' from searching for git repository","startedAt":"2009-09-02T09:58:43Z","lastAt":"2009-10-28T20:26:58Z","messageCount":17,"participants":["Gerrit Pape","Sverre Rabbelier","Rogan Dawes","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"122304","messageId":"20090902095843.28914.qmail@3cd9dde586d86b.315fe32.mid.smarden.org","threadId":"20821","inReplyTo":null,"subject":"[PATCH] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2009-09-02T09:58:43Z","receivedAt":"2009-09-02T09:58:43Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On 'git <TAB><TAB>' the bash completion runs 'git help -a'.  Since\n'git help' actually doesn't need to be run inside a git repository,\nthis commit uses the option --git-dir=/nonexistent to prevent it\nfrom searching a git directory.  Unnecessary searching for a git\ndirectory can be annoying in auto-mount environments.\n\nThe annoying behavior and suggested fix has been reported by Vincent\nDanjean through\n http://bugs.debian.org/539273\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n contrib/completion/git-completion.bash |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex bf688e1..d51854a 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -500,7 +500,7 @@ __git_all_commands ()\n \t\treturn\n \tfi\n \tlocal i IFS=\" \"$'\\n'\n-\tfor i in $(git help -a|egrep '^ ')\n+\tfor i in $(git --git-dir=/nonexistent help -a|egrep '^ ')\n \tdo\n \t\tcase $i in\n \t\t*--*)             : helper pattern;;\n-- \n1.6.0.3\n"},{"id":"122306","messageId":"fabb9a1e0909020447p212594cake8c6fe3a43b667ec@mail.gmail.com","threadId":"20821","inReplyTo":"20090902095843.28914.qmail@3cd9dde586d86b.315fe32.mid.smarden.org","subject":"Re: [PATCH] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-09-02T11:47:31Z","receivedAt":"2009-09-02T11:47:31Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Wed, Sep 2, 2009 at 11:58, Gerrit Pape<pape@smarden.org> wrote:\n> +       for i in $(git --git-dir=/nonexistent help -a|egrep '^ ')\n\nWouldn't implementing \"git --no-git-dir\" be more appropriate?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"122401","messageId":"20090904092918.23170.qmail@f4597b4c28fb52.315fe32.mid.smarden.org","threadId":"20821","inReplyTo":"fabb9a1e0909020447p212594cake8c6fe3a43b667ec@mail.gmail.com","subject":"[PATCH 1/2] git: add new option --no-git-dir","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2009-09-04T09:29:18Z","receivedAt":"2009-09-04T09:29:18Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"This commit adds the --no-git-dir option to the git program.  Setting\nthis option prevents the git program from searching for a path to a git\nrepository, which can be useful for commands that do not require one.\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n Documentation/git.txt |    6 +++++-\n git.c                 |    6 +++++-\n setup.c               |    2 ++\n 3 files changed, 12 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex ad44cac..6327203 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n [verse]\n 'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]\n     [-p|--paginate|--no-pager]\n-    [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]\n+    [--bare] [--git-dir=GIT_DIR|--no-git-dir] [--work-tree=GIT_WORK_TREE]\n     [--help] COMMAND [ARGS]\n \n DESCRIPTION\n@@ -212,6 +212,10 @@ help ...`.\n \tsetting the GIT_DIR environment variable. It can be an absolute\n \tpath or relative path to current working directory.\n \n+--no-git-dir::\n+\tDo not set a path to a repository, and do not try to find one.\n+\tSetting this option is equivalent to setting --git-dir=\"\".\n+\n --work-tree=<path>::\n \tSet the path to the working tree.  The value will not be\n \tused in combination with repositories found automatically in\ndiff --git a/git.c b/git.c\nindex 0b22595..8e060b9 100644\n--- a/git.c\n+++ b/git.c\n@@ -5,7 +5,7 @@\n #include \"run-command.h\"\n \n const char git_usage_string[] =\n-\t\"git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]\";\n+\t\"git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR|--no-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@@ -99,6 +99,10 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\tsetenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);\n \t\t\tif (envchanged)\n \t\t\t\t*envchanged = 1;\n+\t\t} else if (!strcmp(cmd, \"--no-git-dir\")) {\n+\t\t\tsetenv(GIT_DIR_ENVIRONMENT, \"\", 1);\n+\t\t\tif (envchanged)\n+\t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--work-tree\")) {\n \t\t\tif (*argc < 2) {\n \t\t\t\tfprintf(stderr, \"No directory given for --work-tree.\\n\" );\ndiff --git a/setup.c b/setup.c\nindex e3781b6..ee9be6e 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -335,6 +335,8 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\t\t*nongit_ok = 1;\n \t\t\treturn NULL;\n \t\t}\n+\t\tif (!*gitdirenv)\n+\t\t\tdie(\"This command requires a git repository\");\n \t\tdie(\"Not a git repository: '%s'\", gitdirenv);\n \t}\n \n-- \n1.6.0.3\n"},{"id":"122402","messageId":"20090904092929.23208.qmail@00cf3567a0e8b4.315fe32.mid.smarden.org","threadId":"20821","inReplyTo":"fabb9a1e0909020447p212594cake8c6fe3a43b667ec@mail.gmail.com","subject":"[PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2009-09-04T09:29:29Z","receivedAt":"2009-09-04T09:29:29Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On 'git <TAB><TAB>' the bash completion runs 'git help -a'.  Since 'git\nhelp' actually doesn't need to be run inside a git repository, this\ncommit uses the --no-git-dir option to prevent it from searching a git\ndirectory.  Unnecessary searching for a git directory can be annoying in\nauto-mount environments.\n\nThe annoying behavior and suggested fix has been reported by Vincent\nDanjean through\n http://bugs.debian.org/539273\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n contrib/completion/git-completion.bash |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex bf688e1..a55e3cd 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -500,7 +500,7 @@ __git_all_commands ()\n \t\treturn\n \tfi\n \tlocal i IFS=\" \"$'\\n'\n-\tfor i in $(git help -a|egrep '^ ')\n+\tfor i in $(git --no-git-dir help -a|egrep '^ ')\n \tdo\n \t\tcase $i in\n \t\t*--*)             : helper pattern;;\n-- \n1.6.0.3\n"},{"id":"122403","messageId":"4AA0E142.4080105@dawes.za.net","threadId":"20821","inReplyTo":"fabb9a1e0909020447p212594cake8c6fe3a43b667ec@mail.gmail.com","subject":"Re: [PATCH] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Rogan Dawes","fromEmail":"discard@dawes.za.net","sentAt":"2009-09-04T09:43:30Z","receivedAt":"2009-09-04T09:43:30Z","isPatch":true,"sender":{"key":"discard@dawes.za.net","avatar":null},"body":"Sverre Rabbelier wrote:\n> Heya,\n> \n> On Wed, Sep 2, 2009 at 11:58, Gerrit Pape<pape@smarden.org> wrote:\n>> +       for i in $(git --git-dir=/nonexistent help -a|egrep '^ ')\n> \n> Wouldn't implementing \"git --no-git-dir\" be more appropriate?\n> \n\nOr documenting which git commands do/don't require a git dir at all?\n\nI assume that documenting those that don't would be better than\ndocumenting those that do . . .\n\nAnd by documenting, I mean in the code, so that the code can DTRT.\n\nOtherwise, having this switch lets people shoot themselves in the foot,\nI'd think.\n\nRogan\n"},{"id":"122404","messageId":"7vvdjzxc9k.fsf@alter.siamese.dyndns.org","threadId":"20821","inReplyTo":"20090904092929.23208.qmail@00cf3567a0e8b4.315fe32.mid.smarden.org","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-04T09:57:59Z","receivedAt":"2009-09-04T09:57:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index bf688e1..a55e3cd 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -500,7 +500,7 @@ __git_all_commands ()\n>  \t\treturn\n>  \tfi\n>  \tlocal i IFS=\" \"$'\\n'\n> -\tfor i in $(git help -a|egrep '^ ')\n> +\tfor i in $(git --no-git-dir help -a|egrep '^ ')\n\nThanks.\n\nWhat the --no-git-dir option actually does is \"pretend that cwd is the git\ndirectory but do not worry if it is not\", which is different from \"there\nis no git directory, so do not barf as long as you do not need to access\ngit-dir\".  The latter is what the name implies, and also additionally it\nimplies \"but please do barf if you ever need to access something from git\ndirectory.\"  I do not know if that holds true with your Patch 1/2, and I\nam a bit too tired to check.\n\nBesides, \"git --git-dir=.\" is shorter to type, and it is equally magical\nthat the user has to know about it anyway.  Hopefully, most of the time\nthe end user would not have to use it directly, and the only demonstrated\nuse case is here in this completion script.\n\nWould it be an option to chuck the Patch 1/2 at least for now and instead\nsay \"git --git-dir=. help -a\" here in this patch?\n"},{"id":"122405","messageId":"alpine.DEB.1.00.0909041217370.4605@intel-tinevez-2-302","threadId":"20821","inReplyTo":"20090904092929.23208.qmail@00cf3567a0e8b4.315fe32.mid.smarden.org","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-09-04T10:22:36Z","receivedAt":"2009-09-04T10:22:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Sep 2009, Gerrit Pape wrote:\n\n> On 'git <TAB><TAB>' the bash completion runs 'git help -a'.\n\nCorrect me if I am wrong, but does \"git help -a\" not list aliases?  If it \ndoes, \"git help\" must search for the Git repository.\n\nIf it does not, then \"git help\" needs fixing, not the completions.  I.e. \nsomething like this:\n\n-- snipsnap --\n[PATCH] git help -a: do not look for a repository\n\n<all the acknowledgements go here>\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n builtin-help.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-help.c b/builtin-help.c\nindex e1eba77..719aa23 100644\n--- a/builtin-help.c\n+++ b/builtin-help.c\n@@ -416,9 +416,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \tconst char *alias;\n \tload_command_list(\"git-\", &main_cmds, &other_cmds);\n \n-\tsetup_git_directory_gently(&nongit);\n-\tgit_config(git_help_config, NULL);\n-\n \targc = parse_options(argc, argv, prefix, builtin_help_options,\n \t\t\tbuiltin_help_usage, 0);\n \n@@ -429,6 +426,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \t\treturn 0;\n \t}\n \n+\tsetup_git_directory_gently(&nongit);\n+\tgit_config(git_help_config, NULL);\n+\n \tif (!argv[0]) {\n \t\tprintf(\"usage: %s\\n\\n\", git_usage_string);\n \t\tlist_common_cmds_help();\n"},{"id":"122407","messageId":"alpine.DEB.1.00.0909041223420.4605@intel-tinevez-2-302","threadId":"20821","inReplyTo":"4AA0E142.4080105@dawes.za.net","subject":"Re: [PATCH] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-09-04T10:32:17Z","receivedAt":"2009-09-04T10:32:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Sep 2009, Rogan Dawes wrote:\n\n> Sverre Rabbelier wrote:\n> \n> > On Wed, Sep 2, 2009 at 11:58, Gerrit Pape<pape@smarden.org> wrote:\n> >> +       for i in $(git --git-dir=/nonexistent help -a|egrep '^ ')\n> > \n> > Wouldn't implementing \"git --no-git-dir\" be more appropriate?\n> \n> Or documenting which git commands do/don't require a git dir at all?\n\nThis patch is not about documentation, but about preventing the \nauto-completion from trying to discover a Git repository (to prevent \nauto-mounting; although I wonder why you would run Git there if you do not \nwant to auto-mount).\n\n> I assume that documenting those that don't would be better than \n> documenting those that do . . .\n\nIt's not as easy as that: some commands, such as \"ls-remote\" do _not_ \nrequire one, but they take it into account (think \"git ls-remote origin\").  \nOther commands, such as \"archive\", have modes in which they _need_ a \nrepository, and other modes where they do not even look for one.\n\n\"git help -a\" seems to be similar to the latter modes of \"archive\".\n\n> And by documenting, I mean in the code, so that the code can DTRT.\n> \n> Otherwise, having this switch lets people shoot themselves in the foot, \n> I'd think.\n\nGit offers plenty of opportunity to shoot yourself in the foot (and it \ndoes not help that we are introducing user-unfriendly constructs like the \ncurrent form of the foreign VCS helpers with more such opportunities, \neither), but for the love of God, I cannot find how \"this switch\" lets \npeople shoot themselves in the foot here.\n\nCiao,\nDscho\n"},{"id":"122423","messageId":"20090904110936.6663.qmail@046e1bfbf7e41d.315fe32.mid.smarden.org","threadId":"20821","inReplyTo":"alpine.DEB.1.00.0909041217370.4605@intel-tinevez-2-302","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2009-09-04T11:09:36Z","receivedAt":"2009-09-04T11:09:36Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On Fri, Sep 04, 2009 at 12:22:36PM +0200, Johannes Schindelin wrote:\n> -- snipsnap --\n> [PATCH] git help -a: do not look for a repository\n\nPerfect, thanks.\n\nAcked-by: Gerrit Pape <pape@smarden.org>\n\n> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n> \n> ---\n> \n>  builtin-help.c |    6 +++---\n>  1 files changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/builtin-help.c b/builtin-help.c\n> index e1eba77..719aa23 100644\n> --- a/builtin-help.c\n> +++ b/builtin-help.c\n> @@ -416,9 +416,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n>  \tconst char *alias;\n>  \tload_command_list(\"git-\", &main_cmds, &other_cmds);\n>  \n> -\tsetup_git_directory_gently(&nongit);\n> -\tgit_config(git_help_config, NULL);\n> -\n>  \targc = parse_options(argc, argv, prefix, builtin_help_options,\n>  \t\t\tbuiltin_help_usage, 0);\n>  \n> @@ -429,6 +426,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n>  \t\treturn 0;\n>  \t}\n>  \n> +\tsetup_git_directory_gently(&nongit);\n> +\tgit_config(git_help_config, NULL);\n> +\n>  \tif (!argv[0]) {\n>  \t\tprintf(\"usage: %s\\n\\n\", git_usage_string);\n>  \t\tlist_common_cmds_help();\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"122429","messageId":"alpine.DEB.1.00.0909041434310.4605@intel-tinevez-2-302","threadId":"20821","inReplyTo":"20090904110936.6663.qmail@046e1bfbf7e41d.315fe32.mid.smarden.org","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-09-04T12:35:00Z","receivedAt":"2009-09-04T12:35:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Sep 2009, Gerrit Pape wrote:\n\n> On Fri, Sep 04, 2009 at 12:22:36PM +0200, Johannes Schindelin wrote:\n> > -- snipsnap --\n> > [PATCH] git help -a: do not look for a repository\n> \n> Perfect, thanks.\n> \n> Acked-by: Gerrit Pape <pape@smarden.org>\n\nHmm... I haven't checked if 'git help -a' wants to discover the (possibly \nrepository-specific) aliases.  Have you?\n\nCiao,\nDscho\n"},{"id":"122433","messageId":"20090904124904.22288.qmail@103db479e31ab7.315fe32.mid.smarden.org","threadId":"20821","inReplyTo":"alpine.DEB.1.00.0909041434310.4605@intel-tinevez-2-302","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2009-09-04T12:49:04Z","receivedAt":"2009-09-04T12:49:04Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"On Fri, Sep 04, 2009 at 02:35:00PM +0200, Johannes Schindelin wrote:\n> Hi,\n> \n> On Fri, 4 Sep 2009, Gerrit Pape wrote:\n> \n> > On Fri, Sep 04, 2009 at 12:22:36PM +0200, Johannes Schindelin wrote:\n> > > -- snipsnap --\n> > > [PATCH] git help -a: do not look for a repository\n> > \n> > Perfect, thanks.\n> > \n> > Acked-by: Gerrit Pape <pape@smarden.org>\n> \n> Hmm... I haven't checked if 'git help -a' wants to discover the (possibly \n> repository-specific) aliases.  Have you?\n\nYes, it doesn't.  Regards, Gerrit.\n"},{"id":"122434","messageId":"alpine.DEB.1.00.0909041452080.4605@intel-tinevez-2-302","threadId":"20821","inReplyTo":"20090904124904.22288.qmail@103db479e31ab7.315fe32.mid.smarden.org","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-09-04T12:52:45Z","receivedAt":"2009-09-04T12:52:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 4 Sep 2009, Gerrit Pape wrote:\n\n> On Fri, Sep 04, 2009 at 02:35:00PM +0200, Johannes Schindelin wrote:\n> > Hi,\n> > \n> > On Fri, 4 Sep 2009, Gerrit Pape wrote:\n> > \n> > > On Fri, Sep 04, 2009 at 12:22:36PM +0200, Johannes Schindelin wrote:\n> > > > -- snipsnap --\n> > > > [PATCH] git help -a: do not look for a repository\n> > > \n> > > Perfect, thanks.\n> > > \n> > > Acked-by: Gerrit Pape <pape@smarden.org>\n> > \n> > Hmm... I haven't checked if 'git help -a' wants to discover the \n> > (possibly repository-specific) aliases.  Have you?\n> \n> Yes, it doesn't.  Regards, Gerrit.\n\nThanks.\n\nJunio, I am serious about this patch (i.e. it is meant for inclusion now).  \nWant me to resend?\n\nCiao,\nDscho\n"},{"id":"122637","messageId":"7vhbver2fp.fsf@alter.siamese.dyndns.org","threadId":"20821","inReplyTo":"alpine.DEB.1.00.0909041452080.4605@intel-tinevez-2-302","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-07T19:15:54Z","receivedAt":"2009-09-07T19:15:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Thanks.\n>\n> Junio, I am serious about this patch (i.e. it is meant for inclusion now).  \n> Want me to resend?\n\nThanks.\n"},{"id":"126013","messageId":"20091027133040.28836.qmail@fe20635a713ff7.315fe32.mid.smarden.org","threadId":"20821","inReplyTo":"20090904110936.6663.qmail@046e1bfbf7e41d.315fe32.mid.smarden.org","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2009-10-27T13:30:40Z","receivedAt":"2009-10-27T13:30:40Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"Hi Junio, I suggest to apply this patch from Johannes to master.\n\nThanks, Gerrit.\n\n\nOn Fri, Sep 04, 2009 at 11:09:36AM +0000, Gerrit Pape wrote:\n> On Fri, Sep 04, 2009 at 12:22:36PM +0200, Johannes Schindelin wrote:\n> > -- snipsnap --\n> > [PATCH] git help -a: do not look for a repository\n> \n> Perfect, thanks.\n> \n> Acked-by: Gerrit Pape <pape@smarden.org>\n> \n> > Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n> > \n> > ---\n> > \n> >  builtin-help.c |    6 +++---\n> >  1 files changed, 3 insertions(+), 3 deletions(-)\n> > \n> > diff --git a/builtin-help.c b/builtin-help.c\n> > index e1eba77..719aa23 100644\n> > --- a/builtin-help.c\n> > +++ b/builtin-help.c\n> > @@ -416,9 +416,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n> >  \tconst char *alias;\n> >  \tload_command_list(\"git-\", &main_cmds, &other_cmds);\n> >  \n> > -\tsetup_git_directory_gently(&nongit);\n> > -\tgit_config(git_help_config, NULL);\n> > -\n> >  \targc = parse_options(argc, argv, prefix, builtin_help_options,\n> >  \t\t\tbuiltin_help_usage, 0);\n> >  \n> > @@ -429,6 +426,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n> >  \t\treturn 0;\n> >  \t}\n> >  \n> > +\tsetup_git_directory_gently(&nongit);\n> > +\tgit_config(git_help_config, NULL);\n> > +\n> >  \tif (!argv[0]) {\n> >  \t\tprintf(\"usage: %s\\n\\n\", git_usage_string);\n> >  \t\tlist_common_cmds_help();\n> > --\n> > To unsubscribe from this list: send the line \"unsubscribe git\" in\n> > the body of a message to majordomo@vger.kernel.org\n> > More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"126087","messageId":"7viqe0yrnu.fsf@alter.siamese.dyndns.org","threadId":"20821","inReplyTo":"20091027133040.28836.qmail@fe20635a713ff7.315fe32.mid.smarden.org","subject":"Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-28T06:11:01Z","receivedAt":"2009-10-28T06:11:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> Hi Junio, I suggest to apply this patch from Johannes to master.\n>\n> Thanks, Gerrit.\n\nCould you help by coming up with a suitable log message?\n\nIt's a bit too much to ask me to hunt for ancient discussion to correct\nthe <<all the ack go here>> myself to describe what the issue was,\nespecially when I wasn't heavily involved in the review of the patch\nitself.  My impression is that the original description of the problem \nand the solution in your first message does not apply to what Dscho and\nyou agreed to be the best solution.\n\n>\n> On Fri, Sep 04, 2009 at 11:09:36AM +0000, Gerrit Pape wrote:\n>> On Fri, Sep 04, 2009 at 12:22:36PM +0200, Johannes Schindelin wrote:\n>> > -- snipsnap --\n>> > [PATCH] git help -a: do not look for a repository\n>> \n>> Perfect, thanks.\n>> \n>> Acked-by: Gerrit Pape <pape@smarden.org>\n>> \n>> > Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n>> > \n>> > ---\n>> > \n>> >  builtin-help.c |    6 +++---\n>> >  1 files changed, 3 insertions(+), 3 deletions(-)\n>> > \n>> > diff --git a/builtin-help.c b/builtin-help.c\n>> > index e1eba77..719aa23 100644\n>> > --- a/builtin-help.c\n>> > +++ b/builtin-help.c\n>> > @@ -416,9 +416,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n>> >  \tconst char *alias;\n>> >  \tload_command_list(\"git-\", &main_cmds, &other_cmds);\n>> >  \n>> > -\tsetup_git_directory_gently(&nongit);\n>> > -\tgit_config(git_help_config, NULL);\n>> > -\n>> >  \targc = parse_options(argc, argv, prefix, builtin_help_options,\n>> >  \t\t\tbuiltin_help_usage, 0);\n>> >  \n>> > @@ -429,6 +426,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n>> >  \t\treturn 0;\n>> >  \t}\n>> >  \n>> > +\tsetup_git_directory_gently(&nongit);\n>> > +\tgit_config(git_help_config, NULL);\n>> > +\n>> >  \tif (!argv[0]) {\n>> >  \t\tprintf(\"usage: %s\\n\\n\", git_usage_string);\n>> >  \t\tlist_common_cmds_help();\n>> > --\n>> > To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> > the body of a message to majordomo@vger.kernel.org\n>> > More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"126119","messageId":"20091028093022.30253.qmail@d8110c1e8cdcdf.315fe32.mid.smarden.org","threadId":"20821","inReplyTo":"7viqe0yrnu.fsf@alter.siamese.dyndns.org","subject":"[PATCH] help -a: do not unnecessarily look for a repository","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2009-10-28T09:30:22Z","receivedAt":"2009-10-28T09:30:22Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"Although 'git help -a' actually doesn't need to be run inside a git\nrepository and uses no repository-specific information, it looks for a\ngit directory.  On 'git <TAB><TAB>' the bash completion runs 'git help\n-a' and unnecessary searching for a git directory can be annoying in\nauto-mount environments.  With this commit, 'git help' no longer\nsearches for a repository when run with the -a option.\n\nThe fix is from Johannes Schindelin, the annoying behavior has been\nreported by Vincent Danjean through\n http://bugs.debian.org/539273\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n\nOn Tue, Oct 27, 2009 at 11:11:01PM -0700, Junio C Hamano wrote:\n> Gerrit Pape <pape@smarden.org> writes:\n> > Hi Junio, I suggest to apply this patch from Johannes to master.\n\n> Could you help by coming up with a suitable log message?\n>\n> It's a bit too much to ask me to hunt for ancient discussion to\n> correct the <<all the ack go here>> myself to describe what the\n> issue was,\n\nSure, sorry for that.  Regards, Gerrit.\n\n\n builtin-help.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-help.c b/builtin-help.c\nindex e1ade8e..ca08519 100644\n--- a/builtin-help.c\n+++ b/builtin-help.c\n@@ -417,9 +417,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \tconst char *alias;\n \tload_command_list(\"git-\", &main_cmds, &other_cmds);\n \n-\tsetup_git_directory_gently(&nongit);\n-\tgit_config(git_help_config, NULL);\n-\n \targc = parse_options(argc, argv, prefix, builtin_help_options,\n \t\t\tbuiltin_help_usage, 0);\n \n@@ -430,6 +427,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n \t\treturn 0;\n \t}\n \n+\tsetup_git_directory_gently(&nongit);\n+\tgit_config(git_help_config, NULL);\n+\n \tif (!argv[0]) {\n \t\tprintf(\"usage: %s\\n\\n\", git_usage_string);\n \t\tlist_common_cmds_help();\n-- \n1.6.5.2\n"},{"id":"126175","messageId":"7vskd3l0x9.fsf@alter.siamese.dyndns.org","threadId":"20821","inReplyTo":"20091028093022.30253.qmail@d8110c1e8cdcdf.315fe32.mid.smarden.org","subject":"Re: [PATCH] help -a: do not unnecessarily look for a repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-28T20:26:58Z","receivedAt":"2009-10-28T20:26:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}