Just checked. What you're *really* supposed to do is
source /usr/lib/git-core/git-sh-setup
in a shell script, after which GIT_DIR will be set, along with some
other things. It might eat some command-line options too, naturally,
like --git-dir. Or, perhaps less intrusively, you can use
GIT_DIR=$(git rev-parse --git-dir || exit 1)
which (see below) does all the following-around needed to find the
"true" top-level repo directory *and* the git dir.
$ pwd
/home/barak/src/git/debian-src/ivtools/src/idraw
$ cat ../../.git
gitdir: ../.git/modules/ivtools
$ git rev-parse --git-dir
/home/barak/src/git/debian-src/.git/modules/ivtools
$ git rev-parse --show-cdup
../../
$ git rev-parse --show-toplevel
/home/barak/src/git/debian-src/ivtools
Cheers,
--Barak.
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]