From: Nguyễn Thái Ngọc Duy Date: Tue, 18 Feb 2014 13:40:06 GMT Subject: [PATCH v3 17/25] setup.c: detect $GIT_COMMON_DIR check_repository_format_gently() Message-ID: <1392730814-19656-18-git-send-email-pclouds@gmail.com> In-Reply-To: <1392730814-19656-1-git-send-email-pclouds@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy --- setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.c b/setup.c index 282fdc9..e56ec11 100644 --- a/setup.c +++ b/setup.c @@ -285,6 +285,10 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok) const char *repo_config; int ret = 0; + get_common_dir(&sb, gitdir); + strbuf_addstr(&sb, "/config"); + repo_config = sb.buf; + /* * git_config() can't be used here because it calls git_pathdup() * to get $GIT_CONFIG/config. That call will make setup_git_env() @@ -294,8 +298,6 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok) * Use a gentler version of git_config() to check if this repo * is a good one. */ - strbuf_addf(&sb, "%s/config", gitdir); - repo_config = sb.buf; git_config_early(check_repository_format_version, NULL, repo_config); if (GIT_REPO_VERSION < repository_format_version) { if (!nongit_ok) -- 1.8.5.2.240.g8478abd