@@ -43,7 +43,7 @@ int git_worktree_list(git_strarray *wts, git_repository *repo)
4343 wts -> count = 0 ;
4444 wts -> strings = NULL ;
4545
46- if ((error = git_buf_printf (& path , "%s/worktrees/" , repo -> commondir )) < 0 )
46+ if ((error = git_buf_joinpath (& path , repo -> commondir , "worktrees/" )) < 0 )
4747 goto exit ;
4848 if (!git_path_exists (path .ptr ) || git_path_is_empty_dir (path .ptr ))
4949 goto exit ;
@@ -182,7 +182,7 @@ int git_worktree_lookup(git_worktree **out, git_repository *repo, const char *na
182182
183183 * out = NULL ;
184184
185- if ((error = git_buf_printf (& path , "%s/worktrees/%s" , repo -> commondir , name )) < 0 )
185+ if ((error = git_buf_join3 (& path , '/' , repo -> commondir , "worktrees" , name )) < 0 )
186186 goto out ;
187187
188188 if ((error = (open_worktree_dir (out , git_repository_workdir (repo ), path .ptr , name ))) < 0 )
@@ -592,7 +592,7 @@ int git_worktree_prune(git_worktree *wt,
592592 }
593593
594594 /* Delete gitdir in parent repository */
595- if ((err = git_buf_printf (& path , "%s/worktrees/%s" , wt -> commondir_path , wt -> name )) < 0 )
595+ if ((err = git_buf_join3 (& path , '/' , wt -> commondir_path , "worktrees" , wt -> name )) < 0 )
596596 goto out ;
597597 if (!git_path_exists (path .ptr ))
598598 {
0 commit comments