git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 4, 2009, 09:57 UTC
Message-ID
<7vvdjzxc9k.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20090904092929.23208.qmail@00cf3567a0e8b4.315fe32.mid.smarden.org>
Gerrit Pape <pape@smarden.org> writes:
Show 10 quoted lines
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index bf688e1..a55e3cd 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -500,7 +500,7 @@ __git_all_commands ()
>  		return
>  	fi
>  	local i IFS=" "$'\n'
> -	for i in $(git help -a|egrep '^ ')
> +	for i in $(git --no-git-dir help -a|egrep '^ ')
Thanks.

What the --no-git-dir option actually does is "pretend that cwd is the git directory but do not worry if it is not", which is different from "there is no git directory, so do not barf as long as you do not need to access git-dir". The latter is what the name implies, and also additionally it implies "but please do barf if you ever need to access something from git directory." I do not know if that holds true with your Patch 1/2, and I am a bit too tired to check.

Besides, "git --git-dir=." is shorter to type, and it is equally magical that the user has to know about it anyway. Hopefully, most of the time the end user would not have to use it directly, and the only demonstrated use case is here in this completion script.

Would it be an option to chuck the Patch 1/2 at least for now and instead say "git --git-dir=. help -a" here in this patch?

Previous: Gerrit PapeNext: Johannes Schindelin
Message 5 of 17 in “git-completion.bash: prevent 'git help' from searching for git repository”
  1. git-completion.bash: prevent 'git help' from searching for git repositoryGerrit Pape, Sep 2, 2009
  2. Sverre RabbelierSep 2, 2009
  3. 1/2 git: add new option --no-git-dirGerrit Pape, Sep 4, 2009
  4. 2/2 git-completion.bash: prevent 'git help' from searching for git repositoryGerrit Pape, Sep 4, 2009
  5. Junio C HamanoSep 4, 2009
  6. Johannes SchindelinSep 4, 2009
  7. Gerrit PapeSep 4, 2009
  8. Johannes SchindelinSep 4, 2009
  9. Gerrit PapeSep 4, 2009
  10. Johannes SchindelinSep 4, 2009
  11. Junio C HamanoSep 7, 2009
  12. Gerrit PapeOct 27, 2009
  13. Junio C HamanoOct 28, 2009
  14. help -a: do not unnecessarily look for a repositoryGerrit Pape, Oct 28, 2009
  15. Junio C HamanoOct 28, 2009
  16. Rogan DawesSep 4, 2009
  17. Johannes SchindelinSep 4, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.