diff options
Diffstat (limited to 'worktree.c')
-rw-r--r-- | worktree.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/worktree.c b/worktree.c index 0373faf0dc..28989cf06e 100644 --- a/worktree.c +++ b/worktree.c @@ -267,7 +267,8 @@ static void strbuf_addf_gently(struct strbuf *buf, const char *fmt, ...) va_end(params); } -int validate_worktree(const struct worktree *wt, struct strbuf *errmsg) +int validate_worktree(const struct worktree *wt, struct strbuf *errmsg, + unsigned flags) { struct strbuf wt_path = STRBUF_INIT; char *path = NULL; @@ -303,6 +304,12 @@ int validate_worktree(const struct worktree *wt, struct strbuf *errmsg) goto done; } + if (flags & WT_VALIDATE_WORKTREE_MISSING_OK && + !file_exists(wt->path)) { + ret = 0; + goto done; + } + if (!file_exists(wt_path.buf)) { strbuf_addf_gently(errmsg, _("'%s' does not exist"), wt_path.buf); goto done; |