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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Sep 4, 2009, 10:32 UTC
Message-ID
<alpine.DEB.1.00.0909041223420.4605@intel-tinevez-2-302>
In-Reply-To
<4AA0E142.4080105@dawes.za.net>
Hi,
On Fri, 4 Sep 2009, Rogan Dawes wrote:
Show 8 quoted lines
> Sverre Rabbelier wrote:
> 
> > On Wed, Sep 2, 2009 at 11:58, Gerrit Pape<pape@smarden.org> wrote:
> >> +       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

Previous: Rogan Dawes
Message 17 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.