make sure nobody touched the ref, and unlink */
| 1318 | |
| 1319 | /* make sure nobody touched the ref, and unlink */ |
| 1320 | static void prune_ref(struct files_ref_store *refs, struct ref_to_prune *r) |
| 1321 | { |
| 1322 | struct ref_transaction *transaction; |
| 1323 | struct strbuf err = STRBUF_INIT; |
| 1324 | int ret = -1; |
| 1325 | |
| 1326 | if (check_refname_format(r->name, 0)) |
| 1327 | return; |
| 1328 | |
| 1329 | transaction = ref_store_transaction_begin(&refs->base, 0, &err); |
| 1330 | if (!transaction) |
| 1331 | goto cleanup; |
| 1332 | ref_transaction_add_update( |
| 1333 | transaction, r->name, |
| 1334 | REF_NO_DEREF | REF_HAVE_NEW | REF_HAVE_OLD | REF_IS_PRUNING, |
| 1335 | null_oid(the_hash_algo), &r->oid, NULL, NULL, NULL, |
| 1336 | NULL, NULL); |
| 1337 | if (ref_transaction_commit(transaction, &err)) |
| 1338 | goto cleanup; |
| 1339 | |
| 1340 | ret = 0; |
| 1341 | |
| 1342 | cleanup: |
| 1343 | if (ret) |
| 1344 | error("%s", err.buf); |
| 1345 | strbuf_release(&err); |
| 1346 | ref_transaction_free(transaction); |
| 1347 | return; |
| 1348 | } |
| 1349 | |
| 1350 | /* |
| 1351 | * Prune the loose versions of the references in the linked list |
no test coverage detected