Skip to content

Commit 6405ce2

Browse files
committed
worktree: Added worktree_dir check
Fixes libgit2#5280
1 parent 848c779 commit 6405ce2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/worktree.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,14 @@ int git_worktree_validate(const git_worktree *wt)
259259
wt->commondir_path);
260260
return GIT_ERROR;
261261
}
262-
262+
263+
if (!git_path_exists(wt->worktree_path)) {
264+
git_error_set(GIT_ERROR_WORKTREE,
265+
"worktree directory ('%s') does not exist ",
266+
wt->worktree_path);
267+
return GIT_ERROR;
268+
}
269+
263270
return 0;
264271
}
265272

0 commit comments

Comments
 (0)