Re: rev-parse --show-cdup in .git

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano venit, vidit, dixit 04.12.2009 18:32:
> Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]