| 249 | } |
| 250 | |
| 251 | static 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 | |
| 270 | static void merge_clear(struct branch *branch) |
| 271 | { |
no test coverage detected