Commit 1da6329f by Etienne Samson

worktree: don't return "untyped" negative numbers as error codes

parent 292a6eca
......@@ -234,37 +234,30 @@ void git_worktree_free(git_worktree *wt)
int git_worktree_validate(const git_worktree *wt)
{
int err = 0;
assert(wt);
if (!is_worktree_dir(wt->gitdir_path)) {
giterr_set(GITERR_WORKTREE,
"Worktree gitdir ('%s') is not valid",
wt->gitlink_path);
err = -1;
goto out;
return GIT_ERROR;
}
if (wt->parent_path && !git_path_exists(wt->parent_path)) {
giterr_set(GITERR_WORKTREE,
"Worktree parent directory ('%s') does not exist ",
wt->parent_path);
err = -2;
goto out;
return GIT_ERROR;
}
if (!git_path_exists(wt->commondir_path)) {
giterr_set(GITERR_WORKTREE,
"Worktree common directory ('%s') does not exist ",
wt->commondir_path);
err = -3;
goto out;
return GIT_ERROR;
}
out:
return err;
return 0;
}
int git_worktree_add_init_options(git_worktree_add_options *opts,
......
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