Subject: Re: [PATCH] setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR

From: Junio C Hamano <[email-masked]>
Date: Fri, 26 Jun 2015 12:02:42 -0700

Junio C Hamano <[email-masked]> writes:

> But I am not sure if it is true for our children (e.g. hooks,
> filters etc. that is spawned by us).  With this change, they inherit
> GIT_WORK_TREE and no GIT_DIR, in such a case.  If they set GIT_DIR
> themselves for their own use, perhaps arranging to work in somewhere
> else they know by chdir'ing there, they did not have to set
> GIT_WORK_TREE=. before runing git in there, but now they do, because
> we start exporting GIT_WORK_TREE to interfere what they have been
> doing.
>
> "It does not harm" is probably false for our children, I would
> think.  The children can do new things to avoid the harm, though.

Actually, I think I am overly and unnecessarily worried in the
above.

We do not do anything special wrt existing GIT_ environment
variables the user exported into us when spawning hooks or filters;
if existing scripts wanted to visit a different repository and
interact with it while they do their work, they would have already
been seeing these variables in their environment inherited from us,
and they should have been protecting themselves from these settings
anyway.  So I do not think this patch breaks anything (other than
such scripts that are already broken).

So, sorry for a false alarm.  Queued.