Commit 292a6eca by Etienne Samson

worktree: skip building a buffer when validating

parent 8356bf7e
...@@ -234,13 +234,11 @@ void git_worktree_free(git_worktree *wt) ...@@ -234,13 +234,11 @@ void git_worktree_free(git_worktree *wt)
int git_worktree_validate(const git_worktree *wt) int git_worktree_validate(const git_worktree *wt)
{ {
git_buf buf = GIT_BUF_INIT;
int err = 0; int err = 0;
assert(wt); assert(wt);
git_buf_puts(&buf, wt->gitdir_path); if (!is_worktree_dir(wt->gitdir_path)) {
if (!is_worktree_dir(buf.ptr)) {
giterr_set(GITERR_WORKTREE, giterr_set(GITERR_WORKTREE,
"Worktree gitdir ('%s') is not valid", "Worktree gitdir ('%s') is not valid",
wt->gitlink_path); wt->gitlink_path);
...@@ -265,7 +263,6 @@ int git_worktree_validate(const git_worktree *wt) ...@@ -265,7 +263,6 @@ int git_worktree_validate(const git_worktree *wt)
} }
out: out:
git_buf_dispose(&buf);
return err; return err;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment