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

Function update_remote

http-push.c:1392–1428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1390}
1391
1392static int update_remote(const struct object_id *oid, struct remote_lock *lock)
1393{
1394 struct active_request_slot *slot;
1395 struct slot_results results;
1396 struct buffer out_buffer = { STRBUF_INIT, 0 };
1397 struct curl_slist *dav_headers;
1398
1399 dav_headers = get_dav_token_headers(lock, DAV_HEADER_IF);
1400
1401 strbuf_addf(&out_buffer.buf, "%s\n", oid_to_hex(oid));
1402
1403 slot = get_active_slot();
1404 slot->results = &results;
1405 curl_setup_http(slot->curl, lock->url, DAV_PUT,
1406 &out_buffer, fwrite_null);
1407 curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
1408
1409 if (start_active_slot(slot)) {
1410 run_active_slot(slot);
1411 strbuf_release(&out_buffer.buf);
1412 curl_slist_free_all(dav_headers);
1413 if (results.curl_result != CURLE_OK) {
1414 fprintf(stderr,
1415 "PUT error: curl result=%d, HTTP code=%ld\n",
1416 results.curl_result, results.http_code);
1417 /* We should attempt recovery? */
1418 return 0;
1419 }
1420 } else {
1421 strbuf_release(&out_buffer.buf);
1422 curl_slist_free_all(dav_headers);
1423 fprintf(stderr, "Unable to start PUT request\n");
1424 return 0;
1425 }
1426
1427 return 1;
1428}
1429
1430static struct ref *remote_refs;
1431

Callers 1

cmd_mainFunction · 0.85

Calls 8

get_dav_token_headersFunction · 0.85
strbuf_addfFunction · 0.85
oid_to_hexFunction · 0.85
get_active_slotFunction · 0.85
curl_setup_httpFunction · 0.85
start_active_slotFunction · 0.85
run_active_slotFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected