From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Jeff King" <peff@peff.net>,
git@vger.kernel.org
Subject: Re: git-shortlog hangs on bare repo without --bare option
Date: Wed, 27 Aug 2008 16:09:59 -0700 [thread overview]
Message-ID: <7vfxoqm4vs.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vod3em67d.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Wed, 27 Aug 2008 15:41:26 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> And I think this is related to the complexity that snuck in when worktree
> feature was added to the setup sequence.
>
> Untested, but I think this would help.
While it might help, I see there are more serious issue 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"!!!!
And that was part of the reason why "git-shortlog" started from a bare
repository did not even notice that the default "HEAD" that is given
internally by the program is not a valid ref (because it tries to read
from .git/HEAD without the patch I sent earlier).
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)...
* Have a single function "git_setup()" that notices --bare and --git-dir
from the command line and GIT_DIR environment, and does the discovery
of git_dir (if not told with the command line or environment
explicitly); if we do not find it, do *NOT* barf. Just record the
facts it finds somewhere (e.g. the location of git_dir, absense of
git_dir, if the repository is explicitly bare, etc.).
* As the next step, still in this single function, if we have git_dir,
find out where the work_tree is, paying attention to --work-tree from
the command line and GIT_WORK_TREE environment if exists. If we do not
have work tree, do *NOT* barf. Again, just record the facts it finds.
If we do not have --work-tree from the command line and if we are not
told that it is --bare from the command line, then we may need to open
the config to see where core.worktree points at.
* Before returning from that single setup function, i think it is Ok to
make it mimick the current git_setup_directory_gently(), cd up to the
normal work-tree top if needed, and make it return prefix.
* After all of the above is done, then we can start futzing with other
things such as pager. At that point we know we can read from the
correct configuratoin.
* Each individual command may decide to refuse to work in the absense of
git_dir and/or work_tree, by calling require_work_tree(), etc.
Hmm?
next prev parent reply other threads:[~2008-08-27 23:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 19:52 git-shortlog hangs on bare repo without --bare option Garry Dolley
2008-08-27 20:32 ` Junio C Hamano
2008-08-27 21:21 ` Garry Dolley
2008-08-27 21:40 ` René Scharfe
2008-08-27 22:15 ` Garry Dolley
2008-08-27 22:19 ` Junio C Hamano
2008-08-27 22:41 ` Junio C Hamano
2008-08-27 23:09 ` Junio C Hamano [this message]
2008-08-27 23:16 ` Junio C Hamano
2008-08-27 23:30 ` Jeff King
2008-08-28 4:56 ` Junio C Hamano
2008-08-28 7:16 ` Nguyen Thai Ngoc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vfxoqm4vs.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=rene.scharfe@lsrfire.ath.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.