refs: add rejection detail to the callback function

The previous commit started storing the rejection details alongside the
error code for rejected updates. Pass this along to the callback
function `ref_transaction_for_each_rejected_update()`. Currently the
field is unused, but will be integrated in the upcoming commits.

Co-authored-by: Jeff King <peff@peff.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Karthik Nayak 2026-01-20 10:59:20 +01:00 committed by Junio C Hamano
parent c8c0b7f5aa
commit cad57fed2a
5 changed files with 5 additions and 1 deletions

View File

@ -1649,6 +1649,7 @@ static void ref_transaction_rejection_handler(const char *refname,
const char *old_target UNUSED,
const char *new_target UNUSED,
enum ref_transaction_error err,
const char *details UNUSED,
void *cb_data)
{
struct ref_rejection_data *data = cb_data;

View File

@ -1813,6 +1813,7 @@ static void ref_transaction_rejection_handler(const char *refname,
const char *old_target UNUSED,
const char *new_target UNUSED,
enum ref_transaction_error err,
const char *details UNUSED,
void *cb_data)
{
struct strmap *failed_refs = cb_data;

View File

@ -573,6 +573,7 @@ static void print_rejected_refs(const char *refname,
const char *old_target,
const char *new_target,
enum ref_transaction_error err,
const char *details UNUSED,
void *cb_data UNUSED)
{
struct strbuf sb = STRBUF_INIT;

2
refs.c
View File

@ -2874,7 +2874,7 @@ void ref_transaction_for_each_rejected_update(struct ref_transaction *transactio
(update->flags & REF_HAVE_OLD) ? &update->old_oid : NULL,
(update->flags & REF_HAVE_NEW) ? &update->new_oid : NULL,
update->old_target, update->new_target,
update->rejection_err, cb_data);
update->rejection_err, update->rejection_details, cb_data);
}
}

1
refs.h
View File

@ -975,6 +975,7 @@ typedef void ref_transaction_for_each_rejected_update_fn(const char *refname,
const char *old_target,
const char *new_target,
enum ref_transaction_error err,
const char *details,
void *cb_data);
void ref_transaction_for_each_rejected_update(struct ref_transaction *transaction,
ref_transaction_for_each_rejected_update_fn cb,