@@ -48,6 +48,19 @@ static void cleanup_repository(void *path)
4848 cl_fixture_cleanup ((const char * )path );
4949}
5050
51+ static void configure_tmp_global_path (git_buf * out )
52+ {
53+ cl_git_pass (git_libgit2_opts (GIT_OPT_GET_SEARCH_PATH ,
54+ GIT_CONFIG_LEVEL_GLOBAL , & _tmp_path ));
55+ cl_git_pass (git_buf_puts (& _tmp_path , ".tmp" ));
56+ cl_git_pass (git_libgit2_opts (GIT_OPT_SET_SEARCH_PATH ,
57+ GIT_CONFIG_LEVEL_GLOBAL , _tmp_path .ptr ));
58+
59+ cl_must_pass (p_mkdir (_tmp_path .ptr , 0777 ));
60+
61+ cl_git_pass (git_buf_joinpath (out , _tmp_path .ptr , ".gitconfig" ));
62+ }
63+
5164static void ensure_repository_init (
5265 const char * working_directory ,
5366 int is_bare ,
@@ -572,15 +585,7 @@ static void configure_templatedir(const char *template_path)
572585 git_buf config_path = GIT_BUF_INIT ;
573586 git_buf config_data = GIT_BUF_INIT ;
574587
575- cl_git_pass (git_libgit2_opts (GIT_OPT_GET_SEARCH_PATH ,
576- GIT_CONFIG_LEVEL_GLOBAL , & _tmp_path ));
577- cl_git_pass (git_buf_puts (& _tmp_path , ".tmp" ));
578- cl_git_pass (git_libgit2_opts (GIT_OPT_SET_SEARCH_PATH ,
579- GIT_CONFIG_LEVEL_GLOBAL , _tmp_path .ptr ));
580-
581- cl_must_pass (p_mkdir (_tmp_path .ptr , 0777 ));
582-
583- cl_git_pass (git_buf_joinpath (& config_path , _tmp_path .ptr , ".gitconfig" ));
588+ configure_tmp_global_path (& config_path );
584589
585590 cl_git_pass (git_buf_printf (& config_data ,
586591 "[init]\n\ttemplatedir = \"%s\"\n" , template_path ));
0 commit comments