Junio C Hamano wrote:
> Karsten Blees <karsten.bl...@gmail.com> writes:

>> If we don't want to support this, though, I think it would be more
>> approrpiate to issue a warning if GIT_DIR points to a worktree
>> location.
> But how do tell what is and isn't a "worktree location"?  Having the
> path in the index would be one, but you may find it out only after
> issuing "git checkout $antient_commit".

I think the idea was that *any* path under $(git rev-parse
--show-toplevel) would not be a valid GIT_DIR, unless its last path
component is ".git".

Alas, I don't think that would work smoothly.

 - Some people may already be using GIT_DIR=$HOME/dotfiles.git to
   track some files with a toplevel of $HOME.  That is error-prone and
   it would be cleaner to either use plain .git or keep the $GIT_DIR
   outside the worktree (for example by tucking dotfiles into a
   separate $HOME/dotfiles dir), true, but producing a noisy warning
   with no way out would not serve these people well.

 - There is no outside-the-worktree location when GIT_WORK_TREE=/.

So your suggestion of at least noticing when "git checkout" wants to
write files that overlap with the GIT_DIR seems simpler.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to