| 1454 | } |
| 1455 | |
| 1456 | int ref_transaction_update_reflog(struct ref_transaction *transaction, |
| 1457 | const char *refname, |
| 1458 | const struct object_id *new_oid, |
| 1459 | const struct object_id *old_oid, |
| 1460 | const char *committer_info, |
| 1461 | const char *msg, |
| 1462 | uint64_t index, |
| 1463 | struct strbuf *err) |
| 1464 | { |
| 1465 | struct ref_update *update; |
| 1466 | unsigned int flags; |
| 1467 | |
| 1468 | assert(err); |
| 1469 | |
| 1470 | flags = REF_HAVE_OLD | REF_HAVE_NEW | REF_LOG_ONLY | REF_FORCE_CREATE_REFLOG | REF_NO_DEREF | |
| 1471 | REF_LOG_USE_PROVIDED_OIDS; |
| 1472 | |
| 1473 | if (!transaction_refname_valid(refname, new_oid, flags, err)) |
| 1474 | return -1; |
| 1475 | |
| 1476 | update = ref_transaction_add_update(transaction, refname, flags, |
| 1477 | new_oid, old_oid, NULL, NULL, NULL, |
| 1478 | committer_info, msg); |
| 1479 | update->index = index; |
| 1480 | |
| 1481 | /* |
| 1482 | * Reference backends may need to know the max index to optimize |
| 1483 | * their writes. So we store the max_index on the transaction level. |
| 1484 | */ |
| 1485 | if (index > transaction->max_index) |
| 1486 | transaction->max_index = index; |
| 1487 | |
| 1488 | return 0; |
| 1489 | } |
| 1490 | |
| 1491 | int ref_transaction_create(struct ref_transaction *transaction, |
| 1492 | const char *refname, |
no test coverage detected