Subject: Re: git ate my home directory :-(

From: Jonathan Nieder <[email-masked]>
Date: Mon, 25 Mar 2013 15:13:55 -0700

Junio C Hamano wrote:

>                                                            I do not
> know how things will break when the end user sets and exports it to
> the environment, and I do not think we would want to make any
> promise on how it works.

That's a reasonable desire, and it means it's a good thing we noticed
this before the envvar escaped to "master".  People *will* use such
exposed interfaces unless they are clearly marked as internal.  That's
just a fact of life.

Here's a rough patch to hopefully improve matters.

Longer term, it would be nice to have something like
GIT_IMPLICIT_WORK_TREE exposed to let scripts cache the result of the
search for .git.  Maybe something like "GIT_BARE=(arbitrary value)"
would be a good interface.

Signed-off-by: Jonathan Nieder <[email-masked]>
---

diff --git a/cache.h b/cache.h
index 59e5b53..8f92b6d 100644
--- a/cache.h
+++ b/cache.h
@@ -377,7 +377,7 @@ static inline enum object_type object_type(unsigned int mode)
  * of this, but we use it internally to communicate to sub-processes that we
  * are in a bare repo. If not set, defaults to true.
  */
-#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT "GIT_IMPLICIT_WORK_TREE"
+#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT "GIT_INTERNAL_IMPLICIT_WORK_TREE"
 
 /*
  * Repository-local GIT_* environment variables; these will be cleared