Merge branch 'ks/maint-getenv-fix'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 Dec 2010 19:24:13 +0000 (11:24 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Dec 2010 19:24:13 +0000 (11:24 -0800)
* ks/maint-getenv-fix:
setup: make sure git_dir path is in a permanent buffer, getenv(3) case

environment.c
index 913b0580afbe6414af4d08518f5f356817bd0cb6..c79f2a9b561de77e27abd7ee26831e2a58beb259 100644 (file)
@@ -88,6 +88,7 @@ const char * const local_repo_env[LOCAL_REPO_ENV_SIZE + 1] = {
 static void setup_git_env(void)
 {
        git_dir = getenv(GIT_DIR_ENVIRONMENT);
+       git_dir = git_dir ? xstrdup(git_dir) : NULL;
        if (!git_dir) {
                git_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
                git_dir = git_dir ? xstrdup(git_dir) : NULL;