File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,7 +342,9 @@ void setup_work_tree(void)
342342
343343static int check_repository_format_gently (const char * gitdir , int * nongit_ok )
344344{
345- char repo_config [PATH_MAX + 1 ];
345+ struct strbuf sb = STRBUF_INIT ;
346+ const char * repo_config ;
347+ int ret = 0 ;
346348
347349 /*
348350 * git_config() can't be used here because it calls git_pathdup()
@@ -353,7 +355,8 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
353355 * Use a gentler version of git_config() to check if this repo
354356 * is a good one.
355357 */
356- snprintf (repo_config , PATH_MAX , "%s/config" , gitdir );
358+ strbuf_addf (& sb , "%s/config" , gitdir );
359+ repo_config = sb .buf ;
357360 git_config_early (check_repository_format_version , NULL , repo_config );
358361 if (GIT_REPO_VERSION < repository_format_version ) {
359362 if (!nongit_ok )
@@ -363,9 +366,10 @@ static int check_repository_format_gently(const char *gitdir, int *nongit_ok)
363366 GIT_REPO_VERSION , repository_format_version );
364367 warning ("Please upgrade Git" );
365368 * nongit_ok = -1 ;
366- return -1 ;
369+ ret = -1 ;
367370 }
368- return 0 ;
371+ strbuf_release (& sb );
372+ return ret ;
369373}
370374
371375/*
You can’t perform that action at this time.
0 commit comments