Skip to content

Commit e61a509

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent 7d0fb0d commit e61a509

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

setup.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
346346
const char *repo_config;
347347
int ret = 0;
348348

349+
get_common_dir(&sb, gitdir);
350+
strbuf_addstr(&sb, "/config");
351+
repo_config = sb.buf;
352+
349353
/*
350354
* git_config() can't be used here because it calls git_pathdup()
351355
* 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)
355359
* Use a gentler version of git_config() to check if this repo
356360
* is a good one.
357361
*/
358-
strbuf_addf(&sb, "%s/config", gitdir);
359-
repo_config = sb.buf;
360362
git_config_early(check_repository_format_version, NULL, repo_config);
361363
if (GIT_REPO_VERSION < repository_format_version) {
362364
if (!nongit_ok)

0 commit comments

Comments
 (0)