1#ifndef WORKTREE_H 2#define WORKTREE_H 3 4struct worktree { 5 char *path; 6 char *git_dir; 7}; 8 9/* Functions for acting on the information about worktrees. */ 10 11/* 12 * Get the worktrees. The primary worktree will always be the first returned, 13 * and linked worktrees will be pointed to by 'next' in each subsequent 14 * worktree. No specific ordering is done on the linked worktrees. 15 * 16 * The caller is responsible for freeing the memory from the returned 17 * worktree(s). 18 */ 19extern struct worktree **get_worktrees(void); 20 21/* 22 * Free up the memory for worktree(s) 23 */ 24extern void free_worktrees(struct worktree **); 25 26/* 27 * Check if a per-worktree symref points to a ref in the main worktree 28 * or any linked worktree, and return the path to the exising worktree 29 * if it is. Returns NULL if there is no existing ref. The caller is 30 * responsible for freeing the returned path. 31 */ 32extern char *find_shared_symref(const char *symref, const char *target); 33 34#endif