summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2018-06-29 14:39:17 +0200
committerEtienne Samson <samson.etienne@gmail.com>2018-06-29 14:39:17 +0200
commit1da6329fd7f862ac355178dc89c8b321f420fca6 (patch)
treee6e95af50c0fc075f8273239bb45219fb2d2dc83
parent292a6eca338932d33e9de77956919a781c9c4bd6 (diff)
downloadlibgit2-1da6329fd7f862ac355178dc89c8b321f420fca6.tar.gz
worktree: don't return "untyped" negative numbers as error codes
-rw-r--r--src/worktree.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/worktree.c b/src/worktree.c
index 74e7a2fb9..610fd7ee3 100644
--- a/src/worktree.c
+++ b/src/worktree.c
@@ -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,