MCPcopy Index your code
hub / github.com/git/git / add_head_info

Function add_head_info

worktree.c:41–57  ·  view source on GitHub ↗

* Update head_oid, head_ref and is_detached of the given worktree */

Source from the content-addressed store, hash-verified

39 * Update head_oid, head_ref and is_detached of the given worktree
40 */
41static 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
59static int is_current_worktree(struct worktree *wt)
60{

Callers 3

get_current_worktreeFunction · 0.85
get_main_worktreeFunction · 0.85
get_linked_worktreeFunction · 0.85

Calls 3

refs_resolve_ref_unsafeFunction · 0.85
get_worktree_ref_storeFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected