git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: rev-parse --show-cdup in .git
Date: Sat, 05 Dec 2009 14:19:07 +0100	[thread overview]
Message-ID: <4B1A5DCB.7020903@drmicha.warpmail.net> (raw)
In-Reply-To: <7vhbs6skzi.fsf@alter.siamese.dyndns.org>

Junio C Hamano venit, vidit, dixit 04.12.2009 18:32:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> I'm sure this was discussed somewhere, but I can't find it:
>>
>> When called from within .git, git rev-parse --show-cdup returns nothing
>> rather than "..", not even an error code. Is this intended?
> 
> I do not think --show-cdup should be linked to --is-inside-work-tree in
> any way, if that is what you are getting at by mentioning "error code".

It's just difficult to tell from the output whether you are at the
toplevel (empty relative path) or you're within .git or somewhere else.

>> This is all the more disturbing since the cwd of hooks seems to be
>> GIT_DIR. Is that something one can rely upon? In that case one can
>> simply use ".." for cdup.
> 
> I think you will see something that is different from and is more sensible
> than ".." when you use GIT_WORK_TREE environment variable (or its
> corresponding configuration variable).

All that I want is a reliable method for a hook to cd to the toplevel of
the worktree of a non-bare repositity. cd_to_toplevel (from
git-sh-setup) does not work. I don't think I should have to set any
worktree config in a non-bare repository with standard layout, should I?

Michael

      reply	other threads:[~2009-12-05 13:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04 15:45 rev-parse --show-cdup in .git Michael J Gruber
2009-12-04 17:32 ` Junio C Hamano
2009-12-05 13:19   ` Michael J Gruber [this message]

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=4B1A5DCB.7020903@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --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).