Jeff King [off-list ref] 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.