summaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-12-16 17:44:30 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-16 18:45:33 +0100
commit4483be36f4477252f785df0c8c40677df8c18828 (patch)
tree8d109c0f4bd799f247730315b9e39ee16b71871b /refs.c
parentrefs: extract out refname verification in transactions (diff)
downloadgit-4483be36f4477252f785df0c8c40677df8c18828.tar.xz
git-4483be36f4477252f785df0c8c40677df8c18828.zip
refs: add `committer_info` to `ref_transaction_add_update()`
The `ref_transaction_add_update()` creates the `ref_update` struct. To facilitate addition of reflogs in the next commit, the function needs to accommodate setting the `committer_info` field in the struct. So modify the function to also take `committer_info` as an argument and set it accordingly. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index 9c9f4940c6..782bf1090a 100644
--- a/refs.c
+++ b/refs.c
@@ -1166,6 +1166,7 @@ struct ref_update *ref_transaction_add_update(
const struct object_id *new_oid,
const struct object_id *old_oid,
const char *new_target, const char *old_target,
+ const char *committer_info,
const char *msg)
{
struct ref_update *update;
@@ -1190,8 +1191,10 @@ struct ref_update *ref_transaction_add_update(
oidcpy(&update->new_oid, new_oid);
if ((flags & REF_HAVE_OLD) && old_oid)
oidcpy(&update->old_oid, old_oid);
- if (!(flags & REF_SKIP_CREATE_REFLOG))
+ if (!(flags & REF_SKIP_CREATE_REFLOG)) {
+ update->committer_info = xstrdup_or_null(committer_info);
update->msg = normalize_reflog_message(msg);
+ }
return update;
}
@@ -1253,7 +1256,7 @@ int ref_transaction_update(struct ref_transaction *transaction,
ref_transaction_add_update(transaction, refname, flags,
new_oid, old_oid, new_target,
- old_target, msg);
+ old_target, NULL, msg);
return 0;
}