MCPcopy Create free account
hub / github.com/git/git / make_branch

Function make_branch

remote.c:251–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251static struct branch *make_branch(struct remote_state *remote_state,
252 const char *name, size_t len)
253{
254 struct branch *ret;
255
256 ret = find_branch(remote_state, name, len);
257 if (ret)
258 return ret;
259
260 CALLOC_ARRAY(ret, 1);
261 ret->name = xstrndup(name, len);
262 ret->refname = xstrfmt("refs/heads/%s", ret->name);
263
264 hashmap_entry_init(&ret->ent, memhash(name, len));
265 if (hashmap_put_entry(&remote_state->branches_hash, ret, ent))
266 BUG("hashmap_put overwrote entry after hashmap_get returned NULL");
267 return ret;
268}
269
270static void merge_clear(struct branch *branch)
271{

Callers 3

handle_configFunction · 0.85
read_configFunction · 0.85
repo_branch_getFunction · 0.85

Calls 5

find_branchFunction · 0.85
xstrndupFunction · 0.85
xstrfmtFunction · 0.85
hashmap_entry_initFunction · 0.85
memhashFunction · 0.85

Tested by

no test coverage detected