From: Alex Riesen Date: Thu, 24 May 2007 07:19:47 GMT Subject: Re: [PATCH 10/22] run-command: optionally clear git environment Message-ID: <81b0412b0705240019u30a21c1dpd2528dfe58a479cb@mail.gmail.com> In-Reply-To: <20070524071527.GM28023@spearce.org> On 5/24/07, Shawn O. Pearce wrote: > Alex Riesen wrote: > > On 5/24/07, skimo@liacs.nl wrote: > > >+ if (cmd->clear_git_env) { > > >+ unsetenv(ALTERNATE_DB_ENVIRONMENT); > > >+ unsetenv(DB_ENVIRONMENT); > > >+ unsetenv(CONFIG_ENVIRONMENT); > > >+ unsetenv(GIT_DIR_ENVIRONMENT); > > >+ unsetenv(GRAFT_ENVIRONMENT); > > >+ unsetenv(INDEX_ENVIRONMENT); > > >+ } > > > > You might want to try the alternative approach from the recently > > proposed patches to do the same, but more generic. Would > > be less code, too. > > Unfortunately Alex's approach means the caller must know the list of > "special Git envvars" that should be cleared when entering into a > subproject Git repository to execute a command. That's horrible code > duplication in the callers of run_command, and is just asking for > trouble later when/if another magic environment variable is added. #define GIT_ENV_LIST ALTERNATE_DB_ENVIRONMENT, \ ...