diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-09-18 11:42:36 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-18 11:42:36 -0700 |
commit | 01e0fa2b3742e41d172933839a75f54d5df36ef3 (patch) | |
tree | eada10d09120348f2d33916b7d1956b290be7d7d /environment.c | |
parent | d5ca1ab395d4994346e13569ad7a7f5cd4acfade (diff) | |
parent | 487a2b732230608fe7f2cdc46c9f11bd646cb1ac (diff) | |
download | git-01e0fa2b3742e41d172933839a75f54d5df36ef3.tar.gz git-01e0fa2b3742e41d172933839a75f54d5df36ef3.tar.xz |
Merge branch 'nd/git-dir-pointing-at-gitfile'
We made sure that we notice the user-supplied GIT_DIR is actually a
gitfile, but did not do the same when the default ".git" is a gitfile.
* nd/git-dir-pointing-at-gitfile:
Make setup_git_env() resolve .git file when $GIT_DIR is not specified
Diffstat (limited to 'environment.c')
-rw-r--r-- | environment.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/environment.c b/environment.c index 5398c36dd..378254c77 100644 --- a/environment.c +++ b/environment.c @@ -123,14 +123,13 @@ static char *expand_namespace(const char *raw_namespace) static void setup_git_env(void) { + const char *gitfile; + git_dir = getenv(GIT_DIR_ENVIRONMENT); - git_dir = git_dir ? xstrdup(git_dir) : NULL; - if (!git_dir) { - git_dir = read_gitfile(DEFAULT_GIT_DIR_ENVIRONMENT); - git_dir = git_dir ? xstrdup(git_dir) : NULL; - } if (!git_dir) git_dir = DEFAULT_GIT_DIR_ENVIRONMENT; + gitfile = read_gitfile(git_dir); + git_dir = xstrdup(gitfile ? gitfile : git_dir); git_object_dir = getenv(DB_ENVIRONMENT); if (!git_object_dir) { git_object_dir = xmalloc(strlen(git_dir) + 9); |