Re: [PATCH/RFC] introduce GIT_WORK_TREE environment variable
- From
- Matthias Lederhofer <matled@gmx.net>
- Date
- Mar 29, 2007, 08:22 UTC
- Message-ID
- <20070329082202.GA4974@moooo.ath.cx>
- In-Reply-To
- <20070328141505.GA16600@moooo.ath.cx>
Matthias Lederhofer <matled@gmx.net> wrote:
> + git_config(git_setup_config);
When $GIT_DIR was not set and the repository is found as a .git
directory $GIT_DIR will be the full path to the .git directory when
calling git_config(). git_config() calls git_path() which calls
get_git_dir() which calls getenv("GIT_DIR").
I'm not sure this is defined behaviour at all:
char *foo = getenv("FOO");
unsetenv("FOO");Does foo still point to the old content of the FOO environment variable? If it does get_git_dir() will always return the full path to the repository directory.
I can think of two ways to solve this (in case this is a problem): 1. Add a function to environment.c which will cause setup_git_env to be called again (either directly or by setting all the pointers to NULL again). 2. Use git_config_from_file() instead of git_config(). This will probably duplicate code from git_config().