Subject: Re: [RFC] introduce GIT_WORK_DIR environment variable

From: Andy Parkins <[email-masked]>
Date: Sun, 11 Mar 2007 08:26:30 +0000

On Sunday 2007, March 11, Junio C Hamano wrote:

> What's the real motivation behind all this?

Coincidentally, I found I was needing this feature just yesterday.

I wanted to keep random configuration files in a repository.  I didn't 
want the directory structure though.  The config files are, of course, 
in my home directory, however I didn't want the danger of putting 
a .git that low in my hierarchy.  Having a .git that is findable from 
any location in my tree seems a bad idea.

So; I put the repository somewhere else and set GIT_DIR.  However that 
scuppered my plans.  Trying to add a config file results in "not in a 
working directory" (of course), because even though git can find the 
repository, it has no way of knowing which directory to consider as the 
root of the working tree.

Let me put this in command form for you:

 $ cd $HOME
 $ export GIT_DIR=$HOME/gitrepos
 $ git init
 $ git add .bashrc
 fatal: add must be run in a work tree

Being able to set GIT_WORKING_DIR would have let me do this.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
[email-masked]