diff options
Diffstat (limited to 'worktree.h')
-rw-r--r-- | worktree.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/worktree.h b/worktree.h index 90e1311fa7..c28a880e18 100644 --- a/worktree.h +++ b/worktree.h @@ -1,12 +1,14 @@ #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]; + struct object_id head_oid; int is_detached; int is_bare; int is_current; @@ -15,6 +17,8 @@ struct worktree { /* Functions for acting on the information about worktrees. */ +#define GWT_SORT_LINKED (1 << 0) /* keeps linked worktrees sorted */ + /* * Get the worktrees. The primary worktree will always be the first returned, * and linked worktrees will be pointed to by 'next' in each subsequent @@ -23,7 +27,12 @@ struct worktree { * The caller is responsible for freeing the memory from the returned * worktree(s). */ -extern struct worktree **get_worktrees(void); +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. @@ -63,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); |