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

Function unlock_remote

http-push.c:956–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954}
955
956static int unlock_remote(struct remote_lock *lock)
957{
958 struct active_request_slot *slot;
959 struct slot_results results;
960 struct remote_lock *prev = repo->locks;
961 struct curl_slist *dav_headers;
962 int rc = 0;
963
964 dav_headers = get_dav_token_headers(lock, DAV_HEADER_LOCK);
965
966 slot = get_active_slot();
967 slot->results = &results;
968 curl_setup_http_get(slot->curl, lock->url, DAV_UNLOCK);
969 curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
970
971 if (start_active_slot(slot)) {
972 run_active_slot(slot);
973 if (results.curl_result == CURLE_OK)
974 rc = 1;
975 else
976 fprintf(stderr, "UNLOCK HTTP error %ld\n",
977 results.http_code);
978 } else {
979 fprintf(stderr, "Unable to start UNLOCK request\n");
980 }
981
982 curl_slist_free_all(dav_headers);
983
984 if (repo->locks == lock) {
985 repo->locks = lock->next;
986 } else {
987 while (prev && prev->next != lock)
988 prev = prev->next;
989 if (prev)
990 prev->next = lock->next;
991 }
992
993 free(lock->owner);
994 free(lock->url);
995 free(lock->token);
996 free(lock);
997
998 return rc;
999}
1000
1001static void remove_locks(void)
1002{

Callers 2

remove_locksFunction · 0.85
cmd_mainFunction · 0.85

Calls 5

get_dav_token_headersFunction · 0.85
get_active_slotFunction · 0.85
curl_setup_http_getFunction · 0.85
start_active_slotFunction · 0.85
run_active_slotFunction · 0.85

Tested by

no test coverage detected