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