Skip to content

Commit 292a6ec

Browse files
committed
worktree: skip building a buffer when validating
1 parent 8356bf7 commit 292a6ec

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/worktree.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,11 @@ void git_worktree_free(git_worktree *wt)
234234

235235
int git_worktree_validate(const git_worktree *wt)
236236
{
237-
git_buf buf = GIT_BUF_INIT;
238237
int err = 0;
239238

240239
assert(wt);
241240

242-
git_buf_puts(&buf, wt->gitdir_path);
243-
if (!is_worktree_dir(buf.ptr)) {
241+
if (!is_worktree_dir(wt->gitdir_path)) {
244242
giterr_set(GITERR_WORKTREE,
245243
"Worktree gitdir ('%s') is not valid",
246244
wt->gitlink_path);
@@ -265,7 +263,6 @@ int git_worktree_validate(const git_worktree *wt)
265263
}
266264

267265
out:
268-
git_buf_dispose(&buf);
269266

270267
return err;
271268
}

0 commit comments

Comments
 (0)