Re: Inconsistent results from git rev-parse --show-toplevel

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

 



On Sat, Jan 25, 2020 at 07:31:20PM +0000, Crabtree, Andrew wrote:

> > From: Junio C Hamano [mailto:gitster@xxxxxxxxx] 
> > Because you do not know where the top level is (otherwise you would not be asking "rev-parse --show-toplevel" about it), either is an option for you, 
> > but you can "unset GIT_DIR" to stop telling Git that it should not
> > perform the repository discovery.
> 
> Gotcha, thanks.  Would it make sense to have 'git rev-parse
> --show-toplevel' error out if GIT_DIR is set?  Or update the rev-parse
> documentation with a warning about GIT_DIR? 

No, it shouldn't be an error; setting GIT_DIR means that your current
directory is the worktree. That _is_ confusing in some situations, but
at this point it's a historical thing that I don't think we want to
change. Discussing it in the documentation might be good (it's probably
in there somewhere already, but a pointer from --show-toplevel doesn't
seem unreasonable).

But the bigger thing, I think, is: who is setting GIT_DIR but not
setting GIT_WORK_TREE to match? Because IMHO that's the situation that
is causing the confusion.

-Peff



[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]

  Powered by Linux