@@ -2264,7 +2264,7 @@ static int is_reinit(void)
22642264 char junk [2 ];
22652265 int ret ;
22662266
2267- git_path_buf ( & buf , "HEAD" );
2267+ repo_git_path_replace ( the_repository , & buf , "HEAD" );
22682268 ret = !access (buf .buf , R_OK ) || readlink (buf .buf , junk , sizeof (junk ) - 1 ) != -1 ;
22692269 strbuf_release (& buf );
22702270 return ret ;
@@ -2316,8 +2316,7 @@ static int create_default_files(const char *template_path,
23162316 int init_shared_repository )
23172317{
23182318 struct stat st1 ;
2319- struct strbuf buf = STRBUF_INIT ;
2320- char * path ;
2319+ struct strbuf path = STRBUF_INIT ;
23212320 int reinit ;
23222321 int filemode ;
23232322 const char * work_tree = repo_get_work_tree (the_repository );
@@ -2358,14 +2357,14 @@ static int create_default_files(const char *template_path,
23582357 initialize_repository_version (fmt -> hash_algo , fmt -> ref_storage_format , reinit );
23592358
23602359 /* Check filemode trustability */
2361- path = git_path_buf ( & buf , "config" );
2360+ repo_git_path_replace ( the_repository , & path , "config" );
23622361 filemode = TEST_FILEMODE ;
2363- if (TEST_FILEMODE && !lstat (path , & st1 )) {
2362+ if (TEST_FILEMODE && !lstat (path . buf , & st1 )) {
23642363 struct stat st2 ;
2365- filemode = (!chmod (path , st1 .st_mode ^ S_IXUSR ) &&
2366- !lstat (path , & st2 ) &&
2364+ filemode = (!chmod (path . buf , st1 .st_mode ^ S_IXUSR ) &&
2365+ !lstat (path . buf , & st2 ) &&
23672366 st1 .st_mode != st2 .st_mode &&
2368- !chmod (path , st1 .st_mode ));
2367+ !chmod (path . buf , st1 .st_mode ));
23692368 if (filemode && !reinit && (st1 .st_mode & S_IXUSR ))
23702369 filemode = 0 ;
23712370 }
@@ -2384,24 +2383,24 @@ static int create_default_files(const char *template_path,
23842383
23852384 if (!reinit ) {
23862385 /* Check if symlink is supported in the work tree */
2387- path = git_path_buf ( & buf , "tXXXXXX" );
2388- if (!close (xmkstemp (path )) &&
2389- !unlink (path ) &&
2390- !symlink ("testing" , path ) &&
2391- !lstat (path , & st1 ) &&
2386+ repo_git_path_replace ( the_repository , & path , "tXXXXXX" );
2387+ if (!close (xmkstemp (path . buf )) &&
2388+ !unlink (path . buf ) &&
2389+ !symlink ("testing" , path . buf ) &&
2390+ !lstat (path . buf , & st1 ) &&
23922391 S_ISLNK (st1 .st_mode ))
2393- unlink (path ); /* good */
2392+ unlink (path . buf ); /* good */
23942393 else
23952394 git_config_set ("core.symlinks" , "false" );
23962395
23972396 /* Check if the filesystem is case-insensitive */
2398- path = git_path_buf ( & buf , "CoNfIg" );
2399- if (!access (path , F_OK ))
2397+ repo_git_path_replace ( the_repository , & path , "CoNfIg" );
2398+ if (!access (path . buf , F_OK ))
24002399 git_config_set ("core.ignorecase" , "true" );
24012400 probe_utf8_pathname_composition ();
24022401 }
24032402
2404- strbuf_release (& buf );
2403+ strbuf_release (& path );
24052404 return reinit ;
24062405}
24072406
0 commit comments