]>
Commit | Line | Data |
---|---|---|
ac6c561b MR |
1 | #ifndef WORKTREE_H |
2 | #define WORKTREE_H | |
3 | ||
51934904 MR |
4 | struct worktree { |
5 | char *path; | |
6 | char *git_dir; | |
92718b74 MR |
7 | char *head_ref; |
8 | unsigned char head_sha1[20]; | |
9 | int is_detached; | |
10 | int is_bare; | |
51934904 MR |
11 | }; |
12 | ||
13 | /* Functions for acting on the information about worktrees. */ | |
14 | ||
15 | /* | |
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. | |
19 | * | |
20 | * The caller is responsible for freeing the memory from the returned | |
21 | * worktree(s). | |
22 | */ | |
23 | extern struct worktree **get_worktrees(void); | |
24 | ||
25 | /* | |
26 | * Free up the memory for worktree(s) | |
27 | */ | |
28 | extern void free_worktrees(struct worktree **); | |
29 | ||
ac6c561b MR |
30 | /* |
31 | * Check if a per-worktree symref points to a ref in the main worktree | |
32 | * or any linked worktree, and return the path to the exising worktree | |
33 | * if it is. Returns NULL if there is no existing ref. The caller is | |
34 | * responsible for freeing the returned path. | |
35 | */ | |
36 | extern char *find_shared_symref(const char *symref, const char *target); | |
37 | ||
38 | #endif |