worktree.c: store "id" instead of "git_dir"
[git.git] / worktree.h
blob3198c8da2a614ed705a0ee25a7c5a9a7c217eaff
1 #ifndef WORKTREE_H
2 #define WORKTREE_H
4 struct worktree {
5 char *path;
6 char *id;
7 char *head_ref;
8 unsigned char head_sha1[20];
9 int is_detached;
10 int is_bare;
13 /* Functions for acting on the information about worktrees. */
16 * Get the worktrees. The primary worktree will always be the first returned,
17 * and linked worktrees will be pointed to by 'next' in each subsequent
18 * worktree. No specific ordering is done on the linked worktrees.
20 * The caller is responsible for freeing the memory from the returned
21 * worktree(s).
23 extern struct worktree **get_worktrees(void);
26 * Return git dir of the worktree. Note that the path may be relative.
27 * If wt is NULL, git dir of current worktree is returned.
29 extern const char *get_worktree_git_dir(const struct worktree *wt);
32 * Free up the memory for worktree(s)
34 extern void free_worktrees(struct worktree **);
37 * Check if a per-worktree symref points to a ref in the main worktree
38 * or any linked worktree, and return the path to the exising worktree
39 * if it is. Returns NULL if there is no existing ref. The caller is
40 * responsible for freeing the returned path.
42 extern char *find_shared_symref(const char *symref, const char *target);
44 #endif