Merge branch 'cb/remove-dead-init'
[gitweb.git] / worktree.h
index 9276c81ae7cb5c42a86fd9ebbdb28720be409e47..df3fc30f73692d296fc875bf1944813fa7e1fb3a 100644 (file)
@@ -1,14 +1,17 @@
 #ifndef WORKTREE_H
 #define WORKTREE_H
 
+#include "cache.h"
 #include "refs.h"
 
+struct strbuf;
+
 struct worktree {
        char *path;
        char *id;
        char *head_ref;         /* NULL if HEAD is broken or detached */
        char *lock_reason;      /* internal use */
-       unsigned char head_sha1[20];
+       struct object_id head_oid;
        int is_detached;
        int is_bare;
        int is_current;
@@ -59,6 +62,22 @@ extern int is_main_worktree(const struct worktree *wt);
  */
 extern const char *is_worktree_locked(struct worktree *wt);
 
+#define WT_VALIDATE_WORKTREE_MISSING_OK (1 << 0)
+
+/*
+ * Return zero if the worktree is in good condition. Error message is
+ * returned if "errmsg" is not NULL.
+ */
+extern int validate_worktree(const struct worktree *wt,
+                            struct strbuf *errmsg,
+                            unsigned flags);
+
+/*
+ * Update worktrees/xxx/gitdir with the new path.
+ */
+extern void update_worktree_location(struct worktree *wt,
+                                    const char *path_);
+
 /*
  * Free up the memory for worktree(s)
  */