Thread (7 messages) flat view 7 messages, 3 authors, 2016-06-15

Re: [PATCH/RFC] introduce GIT_WORK_TREE environment variable

From: Matthias Lederhofer <hidden>
Date: 2016-06-15 22:43:02

Matthias Lederhofer [off-list ref] 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().
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help