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

Function parse_fetch

remote-curl.c:1267–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1265}
1266
1267static void parse_fetch(struct strbuf *buf)
1268{
1269 struct ref **to_fetch = NULL;
1270 struct ref *list_head = NULL;
1271 struct ref **list = &list_head;
1272 int alloc_heads = 0, nr_heads = 0;
1273
1274 do {
1275 const char *p;
1276 if (skip_prefix(buf->buf, "fetch ", &p)) {
1277 const char *name;
1278 struct ref *ref;
1279 struct object_id old_oid;
1280 const char *q;
1281
1282 if (parse_oid_hex(p, &old_oid, &q))
1283 die(_("protocol error: expected sha/ref, got '%s'"), p);
1284 if (*q == ' ')
1285 name = q + 1;
1286 else if (!*q)
1287 name = "";
1288 else
1289 die(_("protocol error: expected sha/ref, got '%s'"), p);
1290
1291 ref = alloc_ref(name);
1292 oidcpy(&ref->old_oid, &old_oid);
1293
1294 *list = ref;
1295 list = &ref->next;
1296
1297 ALLOC_GROW(to_fetch, nr_heads + 1, alloc_heads);
1298 to_fetch[nr_heads++] = ref;
1299 }
1300 else
1301 die(_("http transport does not support %s"), buf->buf);
1302
1303 strbuf_reset(buf);
1304 if (strbuf_getline_lf(buf, stdin) == EOF)
1305 return;
1306 if (!*buf->buf)
1307 break;
1308 } while (1);
1309
1310 if (fetch(nr_heads, to_fetch))
1311 exit(128); /* error already reported */
1312 free_refs(list_head);
1313 free(to_fetch);
1314
1315 printf("\n");
1316 fflush(stdout);
1317 strbuf_reset(buf);
1318}
1319
1320static void parse_get(const char *arg)
1321{

Callers 1

cmd_mainFunction · 0.85

Calls 7

parse_oid_hexFunction · 0.85
alloc_refFunction · 0.85
oidcpyFunction · 0.85
strbuf_getline_lfFunction · 0.85
free_refsFunction · 0.85
dieFunction · 0.70
fetchFunction · 0.70

Tested by

no test coverage detected