mergetools: add support for guiffy
[gitweb.git] / worktree.c
index 0373faf0dc805b78581a92c46149a5bea5567dfe..28989cf06ef4bd15b3b97f86ae9fd32c4b78401f 100644 (file)
@@ -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;