Commit 86db1ad5 by Reginald McLean Committed by Edward Thomson

Added check if gitdir exists in is_prunable()

Fixes #5598
parent 0fd80681
......@@ -565,6 +565,7 @@ int git_worktree_is_prunable(git_worktree *wt,
git_worktree_prune_options *opts)
{
git_worktree_prune_options popts = GIT_WORKTREE_PRUNE_OPTIONS_INIT;
git_buf path = GIT_BUF_INIT;
GIT_ERROR_CHECK_VERSION(
opts, GIT_WORKTREE_PRUNE_OPTIONS_VERSION,
......@@ -595,6 +596,14 @@ int git_worktree_is_prunable(git_worktree *wt,
return 0;
}
if (git_buf_printf(&path, "%s/worktrees/%s", wt->commondir_path, wt->name) < 0)
return 0;
if (!git_path_exists(path.ptr))
{
git_error_set(GIT_ERROR_WORKTREE, "worktree gitdir '%s' does not exist", path.ptr);
return 0;
}
return 1;
}
......
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