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

Re: git-shortlog hangs on bare repo without --bare option

From
Jeff King <peff@peff.net>
Date
Aug 27, 2008, 23:30 UTC
Message-ID
<20080827233056.GA25745@coredump.intra.peff.net>
In-Reply-To
<7v8wuim4kv.fsf@gitster.siamese.dyndns.org>
On Wed, Aug 27, 2008 at 04:16:32PM -0700, Junio C Hamano wrote:
Show 20 quoted lines
> While this might help, I see there are more serious issues here.
> 
> If you start "git-shortlog" (or anything that has USE_PAGER but not
> RUN_SETUP in git.c) inside your project/.git directory (or a bare one, for
> that matter), the call sequence would become like this:
> 
> git.c::main()
>  -> handle_internal_command()
>    -> run_command()
>      -> commit_pager_choice()
>        -> setup_pager() (this is in pager.c)
>          -> git_config(git_default_config, NULL)
>            -> git_path("config")
>              -> get_git_dir()
>                -> setup_git_env()
>                  This sets git_dir to ".git"!!!!
> [...]
> This may be repeating what Jeff said earlier in another thread, but I
> think we should rethink the start-up sequence carefully.  Ideally (I am
> thinking aloud)...

Yep. This is the exact same problem I have been complaining about for a while.

> [some implementation ideas]

Yes, this is roughly what I have been thinking of, as well. IOW, unconditionally find everything right at the beginning, but let us decide whether to barf later, when we know what command we are running.

A few complexities I found were:
  - some things really want no setup, like init and clone. I don't
    recall the exact issues, but trying obvious things caused breakage
    there.
  - the setup needs to not just be part of git.c, but factored out so
    non-builtin C programs can use it. I don't recall if there are
    issues related to git-sh-setup that need to be dealt with.

I think my approach was something like "let's just unconditionally call setup_git_directory() in git.c, and wrap it with a static variable to make sure we don't run it twice." but I ran into a host of issues. Sorry I can't remember specifics.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 12 in “git-shortlog hangs on bare repo without --bare option”
  1. Garry DolleyAug 27, 2008
  2. Junio C HamanoAug 27, 2008
  3. Garry DolleyAug 27, 2008
  4. René ScharfeAug 27, 2008
  5. Garry DolleyAug 27, 2008
  6. Junio C HamanoAug 27, 2008
  7. Junio C HamanoAug 27, 2008
  8. Junio C HamanoAug 27, 2008
  9. Junio C HamanoAug 27, 2008
  10. Jeff KingAug 27, 2008
  11. Junio C HamanoAug 28, 2008
  12. Nguyen Thai Ngoc DuyAug 28, 2008

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.