]>
Commit | Line | Data |
---|---|---|
ac6c561b MR |
1 | #ifndef WORKTREE_H |
2 | #define WORKTREE_H | |
3 | ||
51934904 MR |
4 | struct worktree { |
5 | char *path; | |
69dfe3b9 | 6 | char *id; |
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 | ||
69dfe3b9 NTND |
25 | /* |
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. | |
28 | */ | |
29 | extern const char *get_worktree_git_dir(const struct worktree *wt); | |
30 | ||
51934904 MR |
31 | /* |
32 | * Free up the memory for worktree(s) | |
33 | */ | |
34 | extern void free_worktrees(struct worktree **); | |
35 | ||
ac6c561b MR |
36 | /* |
37 | * Check if a per-worktree symref points to a ref in the main worktree | |
d3b9ac07 NTND |
38 | * or any linked worktree, and return the worktree that holds the ref, |
39 | * or NULL otherwise. The result may be destroyed by the next call. | |
ac6c561b | 40 | */ |
d3b9ac07 NTND |
41 | extern const struct worktree *find_shared_symref(const char *symref, |
42 | const char *target); | |
ac6c561b MR |
43 | |
44 | #endif |