@@ -13,33 +13,18 @@ static const char *REPO2_REFNAME = "refs/remotes/repo1/main";
1313static char * FORCE_FETCHSPEC = "+refs/heads/main:refs/remotes/repo1/main" ;
1414static char * NON_FORCE_FETCHSPEC = "refs/heads/main:refs/remotes/repo1/main" ;
1515
16- char * strip_trailing_slash (char * path ) {
17- if (path [strlen (path ) - 1 ] == '/' ) {
18- char * result = (char * ) calloc (strlen (path ) - 1 , sizeof (char ));
19- memcpy (result , path , strlen (path ) - 1 );
20- return result ;
21- } else {
22- char * result = (char * ) calloc (strlen (path ), sizeof (char ));
23- strncpy (result , path , strlen (path ));
24- return result ;
25- }
26- }
27-
28-
2916void test_remote_fetch__initialize (void ) {
3017 git_config * c ;
3118 git_buf repo1_path_buf = GIT_BUF_INIT ;
3219 git_buf repo2_path_buf = GIT_BUF_INIT ;
3320 const char * sandbox = clar_sandbox_path ();
3421
35- cl_git_pass (git_buf_join (& repo1_path_buf , '/' , sandbox , "fetchtest_repo1" ));
36- repo1_path = calloc (repo1_path_buf .size , sizeof (char ));
37- git_buf_copy_cstr (repo1_path , repo1_path_buf .size , & repo1_path_buf );
22+ cl_git_pass (git_buf_joinpath (& repo1_path_buf , sandbox , "fetchtest_repo1" ));
23+ repo1_path = git_buf_detach (& repo1_path_buf );
3824 cl_git_pass (git_repository_init (& repo1 , repo1_path , true));
3925
40- cl_git_pass (git_buf_join (& repo2_path_buf , '/' , sandbox , "fetchtest_repo2" ));
41- repo2_path = calloc (repo2_path_buf .size , sizeof (char ));
42- git_buf_copy_cstr (repo2_path , repo2_path_buf .size , & repo2_path_buf );
26+ cl_git_pass (git_buf_joinpath (& repo2_path_buf , sandbox , "fetchtest_repo2" ));
27+ repo2_path = git_buf_detach (& repo2_path_buf );
4328 cl_git_pass (git_repository_init (& repo2 , repo2_path , true));
4429
4530 cl_git_pass (git_repository_config (& c , repo1 ));
0 commit comments