From: Gerrit Pape <hidden> Date: 2016-06-15 22:47:21
On 'git <TAB><TAB>' the bash completion runs 'git help -a'. Since
'git help' actually doesn't need to be run inside a git repository,
this commit uses the option --git-dir=/nonexistent to prevent it
from searching a git directory. Unnecessary searching for a git
directory can be annoying in auto-mount environments.
The annoying behavior and suggested fix has been reported by Vincent
Danjean through
http://bugs.debian.org/539273
Signed-off-by: Gerrit Pape <redacted>
---
contrib/completion/git-completion.bash | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Gerrit Pape <hidden> Date: 2016-06-15 22:47:21
This commit adds the --no-git-dir option to the git program. Setting
this option prevents the git program from searching for a path to a git
repository, which can be useful for commands that do not require one.
Signed-off-by: Gerrit Pape <redacted>
---
Documentation/git.txt | 6 +++++-
git.c | 6 +++++-
setup.c | 2 ++
3 files changed, 12 insertions(+), 2 deletions(-)
@@ -212,6 +212,10 @@ help ...`. setting the GIT_DIR environment variable. It can be an absolute path or relative path to current working directory.+--no-git-dir::+ Do not set a path to a repository, and do not try to find one.+ Setting this option is equivalent to setting --git-dir="".+ --work-tree=<path>:: Set the path to the working tree. The value will not be used in combination with repositories found automatically in
@@ -5,7 +5,7 @@#include"run-command.h"constchargit_usage_string[]=-"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]";+"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]";constchargit_more_info_string[]="See 'git help COMMAND' for more information on a specific command.";
@@ -99,6 +99,10 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)setenv(GIT_DIR_ENVIRONMENT,cmd+10,1);if(envchanged)*envchanged=1;+}elseif(!strcmp(cmd,"--no-git-dir")){+setenv(GIT_DIR_ENVIRONMENT,"",1);+if(envchanged)+*envchanged=1;}elseif(!strcmp(cmd,"--work-tree")){if(*argc<2){fprintf(stderr,"No directory given for --work-tree.\n");
From: Gerrit Pape <hidden> Date: 2016-06-15 22:47:21
On 'git <TAB><TAB>' the bash completion runs 'git help -a'. Since 'git
help' actually doesn't need to be run inside a git repository, this
commit uses the --no-git-dir option to prevent it from searching a git
directory. Unnecessary searching for a git directory can be annoying in
auto-mount environments.
The annoying behavior and suggested fix has been reported by Vincent
Danjean through
http://bugs.debian.org/539273
Signed-off-by: Gerrit Pape <redacted>
---
contrib/completion/git-completion.bash | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Heya,
On Wed, Sep 2, 2009 at 11:58, Gerrit Pape[off-list ref] wrote:
quoted
+ for i in $(git --git-dir=/nonexistent help -a|egrep '^ ')
Wouldn't implementing "git --no-git-dir" be more appropriate?
Or documenting which git commands do/don't require a git dir at all?
I assume that documenting those that don't would be better than
documenting those that do . . .
And by documenting, I mean in the code, so that the code can DTRT.
Otherwise, having this switch lets people shoot themselves in the foot,
I'd think.
Rogan
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:47:21
Hi,
On Fri, 4 Sep 2009, Gerrit Pape wrote:
On 'git <TAB><TAB>' the bash completion runs 'git help -a'.
Correct me if I am wrong, but does "git help -a" not list aliases? If it
does, "git help" must search for the Git repository.
If it does not, then "git help" needs fixing, not the completions. I.e.
something like this:
-- snipsnap --
[PATCH] git help -a: do not look for a repository
<all the acknowledgements go here>
Signed-off-by: Johannes Schindelin <redacted>
---
builtin-help.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:47:21
Hi,
On Fri, 4 Sep 2009, Rogan Dawes wrote:
Sverre Rabbelier wrote:
quoted
On Wed, Sep 2, 2009 at 11:58, Gerrit Pape[off-list ref] wrote:
quoted
+ for i in $(git --git-dir=/nonexistent help -a|egrep '^ ')
Wouldn't implementing "git --no-git-dir" be more appropriate?
Or documenting which git commands do/don't require a git dir at all?
This patch is not about documentation, but about preventing the
auto-completion from trying to discover a Git repository (to prevent
auto-mounting; although I wonder why you would run Git there if you do not
want to auto-mount).
I assume that documenting those that don't would be better than
documenting those that do . . .
It's not as easy as that: some commands, such as "ls-remote" do _not_
require one, but they take it into account (think "git ls-remote origin").
Other commands, such as "archive", have modes in which they _need_ a
repository, and other modes where they do not even look for one.
"git help -a" seems to be similar to the latter modes of "archive".
And by documenting, I mean in the code, so that the code can DTRT.
Otherwise, having this switch lets people shoot themselves in the foot,
I'd think.
Git offers plenty of opportunity to shoot yourself in the foot (and it
does not help that we are introducing user-unfriendly constructs like the
current form of the foreign VCS helpers with more such opportunities,
either), but for the love of God, I cannot find how "this switch" lets
people shoot themselves in the foot here.
Ciao,
Dscho
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html