* Update head_oid, head_ref and is_detached of the given worktree */
| 39 | * Update head_oid, head_ref and is_detached of the given worktree |
| 40 | */ |
| 41 | static void add_head_info(struct worktree *wt) |
| 42 | { |
| 43 | int flags; |
| 44 | const char *target; |
| 45 | |
| 46 | target = refs_resolve_ref_unsafe(get_worktree_ref_store(wt), |
| 47 | "HEAD", |
| 48 | 0, |
| 49 | &wt->head_oid, &flags); |
| 50 | if (!target) |
| 51 | return; |
| 52 | |
| 53 | if (flags & REF_ISSYMREF) |
| 54 | wt->head_ref = xstrdup(target); |
| 55 | else |
| 56 | wt->is_detached = 1; |
| 57 | } |
| 58 | |
| 59 | static int is_current_worktree(struct worktree *wt) |
| 60 | { |
no test coverage detected