Imported Upstream version 2.15.4
[platform/upstream/git.git] / worktree.h
index d59ce1f..9276c81 100644 (file)
@@ -1,10 +1,12 @@
 #ifndef WORKTREE_H
 #define WORKTREE_H
 
+#include "refs.h"
+
 struct worktree {
        char *path;
        char *id;
-       char *head_ref;
+       char *head_ref;         /* NULL if HEAD is broken or detached */
        char *lock_reason;      /* internal use */
        unsigned char head_sha1[20];
        int is_detached;
@@ -28,6 +30,11 @@ struct worktree {
 extern struct worktree **get_worktrees(unsigned flags);
 
 /*
+ * Returns 1 if linked worktrees exist, 0 otherwise.
+ */
+extern int submodule_uses_worktrees(const char *path);
+
+/*
  * Return git dir of the worktree. Note that the path may be relative.
  * If wt is NULL, git dir of current worktree is returned.
  */
@@ -65,6 +72,12 @@ extern void free_worktrees(struct worktree **);
 extern const struct worktree *find_shared_symref(const char *symref,
                                                 const char *target);
 
+/*
+ * Similar to head_ref() for all HEADs _except_ one from the current
+ * worktree, which is covered by head_ref().
+ */
+int other_head_refs(each_ref_fn fn, void *cb_data);
+
 int is_worktree_being_rebased(const struct worktree *wt, const char *target);
 int is_worktree_being_bisected(const struct worktree *wt, const char *target);