From: "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: git@vger.kernel.org, "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Subject: Re: [Funky] "git -p cmd" inside a bare repository
Date: Fri, 14 Dec 2007 20:58:52 +0700 [thread overview]
Message-ID: <fcaeb9bf0712140558p37eb3387h7c4d3177473e6fcd@mail.gmail.com> (raw)
In-Reply-To: <7vmysexdvw.fsf@gitster.siamese.dyndns.org>
On Dec 14, 2007 8:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
> If you have a bare repository and try this there:
>
> $ PAGER=head git show HEAD:gcc/ChangeLog
>
> it works as expected, but if you explicitly ask for pagination, like
> this:
>
> $ PAGER=head git -p show HEAD:gcc/ChangeLog
>
> you would get a very funky error message:
>
> fatal: ambiguous argument 'HEAD:gcc/ChangeLog': unknown revision or path not in the working tree.
> Use '--' to separate paths from revisions
>
> as if we are working with a repository with working tree.
>
> I originally noticed this with ls-tree. The symptom is a bit different:
>
> $ git -p ls-tree HEAD
> fatal: Not a valid object name HEAD
>
>
>
> I _think_ what is happening is that setup_pager() tries to run
> git_config(), which runs setup(), and then RUN_SETUP set for "ls-tree"
> (or "show") internal command runs setup again. HEAD is given to
> resolve_ref() and git_path("%s", ref) makes it to ".git/HEAD", even
> though in a bare repository git_dir should be set to ".", and of course
> we cannot find such a path in the git directory.
You meant setup_git_directory() or setup_git_env()? If find that
setup_git_env() is called too soon so it caches wrong git_dir and
friends if you setup_pager().
Another option (BTW I think your patch is fine) is to call
setup_git_env one more time to refresh its cache.
--
Duy
next prev parent reply other threads:[~2007-12-14 13:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-29 12:21 [PATCH v2] Do check_repository_format() early Nguyễn Thái Ngọc Duy
2007-12-14 1:29 ` [Funky] "git -p cmd" inside a bare repository Junio C Hamano
2007-12-14 5:03 ` [PATCH] make git start-up sequence a bit more robust Junio C Hamano
2007-12-14 5:12 ` [Funky] "git -p cmd" inside a bare repository Jeff King
2007-12-14 5:14 ` Jeff King
2007-12-14 6:07 ` Junio C Hamano
2007-12-14 13:58 ` Nguyen Thai Ngoc Duy [this message]
2007-12-14 19:44 ` Johannes Schindelin
2007-12-14 20:18 ` Junio C Hamano
2007-12-14 20:37 ` Johannes Schindelin
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=fcaeb9bf0712140558p37eb3387h7c4d3177473e6fcd@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).