setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Nov 30, 2014 at 15:24 UTC e61a509a497520550b5b84b753a95549158f9f1c
1 file changed +4 -2
setup.c
+4 -2
@@ -346,6 +346,10 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
346 const char *repo_config;
347 int ret = 0;
348
349 + get_common_dir(&sb, gitdir);
350 + strbuf_addstr(&sb, "/config");
351 + repo_config = sb.buf;
352 +
353 /*
354 * git_config() can't be used here because it calls git_pathdup()
355 * to get $GIT_CONFIG/config. That call will make setup_git_env()
@@ -355,8 +359,6 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
359 * Use a gentler version of git_config() to check if this repo
360 * is a good one.
361 */
358 - strbuf_addf(&sb, "%s/config", gitdir);
359 - repo_config = sb.buf;
362 git_config_early(check_repository_format_version, NULL, repo_config);
363 if (GIT_REPO_VERSION < repository_format_version) {
364 if (!nongit_ok)