From: Junio C Hamano Date: Sun, 06 Dec 2009 07:54:42 GMT Subject: Re: git reset --hard in .git causes a checkout in that directory Message-ID: <7vk4x0k059.fsf@alter.siamese.dyndns.org> In-Reply-To: <20091206041839.GB23983@coredump.intra.peff.net> Jeff King writes: > I actually considered that, too, when writing the patch. But that would > be inconsistent with all of the other commands that use SETUP_WORK_TREE. > For example: > > $ git init && cd .git && git clean > fatal: This operation must be run in a work tree > > So I think we are better to be consistent with the other commands. If > somebody wants to make a separate patch to discover the work tree while > in the $GIT_DIR and chdir to it, that should then be applied to all > commands. I'm not opposed to it, but I also don't see it as a > particularly pressing need. Yes, we would of course want to do this consistently. I haven't followed the codepath yet, but I suspect this will end up being connected with running "rev-parse --show-cdup" inside .git/ of a non-bare repository.