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

Function make_remote

remote.c:131–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131static struct remote *make_remote(struct remote_state *remote_state,
132 const char *name, int len)
133{
134 struct remote *ret;
135 struct remotes_hash_key lookup;
136 struct hashmap_entry lookup_entry, *e;
137
138 if (!len)
139 len = strlen(name);
140
141 lookup.str = name;
142 lookup.len = len;
143 hashmap_entry_init(&lookup_entry, memhash(name, len));
144
145 e = hashmap_get(&remote_state->remotes_hash, &lookup_entry, &lookup);
146 if (e)
147 return container_of(e, struct remote, ent);
148
149 CALLOC_ARRAY(ret, 1);
150 ret->prune = -1; /* unspecified */
151 ret->prune_tags = -1; /* unspecified */
152 ret->name = xstrndup(name, len);
153 refspec_init_push(&ret->push);
154 refspec_init_fetch(&ret->fetch);
155 string_list_init_dup(&ret->server_options);
156 string_list_init_dup(&ret->negotiation_restrict);
157 string_list_init_dup(&ret->negotiation_include);
158
159 ALLOC_GROW(remote_state->remotes, remote_state->remotes_nr + 1,
160 remote_state->remotes_alloc);
161 remote_state->remotes[remote_state->remotes_nr++] = ret;
162
163 hashmap_entry_init(&ret->ent, lookup_entry.hash);
164 if (hashmap_put_entry(&remote_state->remotes_hash, ret, ent))
165 BUG("hashmap_put overwrote entry after hashmap_get returned NULL");
166 return ret;
167}
168
169static void remote_clear(struct remote *remote)
170{

Callers 2

handle_configFunction · 0.85
remotes_remote_get_1Function · 0.85

Calls 7

hashmap_entry_initFunction · 0.85
memhashFunction · 0.85
hashmap_getFunction · 0.85
xstrndupFunction · 0.85
refspec_init_pushFunction · 0.85
refspec_init_fetchFunction · 0.85
string_list_init_dupFunction · 0.85

Tested by

no test coverage detected