Jonathan Nieder [off-list ref] writes:
In git versions including the patch 2cd83d10bb6b (setup: suppress
implicit "." work-tree for bare repos, 2013-03-08, currently in "next"
but not "master"), you can set GIT_IMPLICIT_WORK_TREE=0 to avoid this
behavior.
WAT?
Junio C Hamano wrote:
Jonathan Nieder [off-list ref] writes:
quoted
In git versions including the patch 2cd83d10bb6b (setup: suppress
implicit "." work-tree for bare repos, 2013-03-08, currently in "next"
but not "master"), you can set GIT_IMPLICIT_WORK_TREE=0 to avoid this
behavior.
WAT?
Is that false?
If I understand the history correctly, the ability to set the GIT_DIR
envvar was meant to allow a person to keep their .git directory outside
the worktree. So you can do:
git init my-favorite-repo
cd my-favorite-repo
...work as usual...
# cleaning time!
mv .git ~/my-favorite-repo-metadata.git
GIT_DIR=$HOME/my-favorite-repo-metadata.git; export GIT_DIR
... work as usual...
If you want to set GIT_DIR and treat it as a bare repository, the
sane way to do that is simply
cd ~/my-favorite-bare-repository.git
... use git as usual ...
But if something (for example relative paths used by your script)
ties your cwd somewhere else, you might really want to do
GIT_DIR=~/my-favorite-bare-repository.git; export GIT_DIR
... work as usual ...
and as a side effect of Jeff's patch there is now a mechanism to do
that:
GIT_IMPLICIT_WORK_TREE=0; export GIT_IMPLICIT_WORK_TREE
GIT_DIR=~/my-favorite-bare-repository.git; export GIT_DIR
... work as usual ...
This is of course unsafe because it ties your usage to a specific
version of git. And the variable is not advertised in the
documentation.