diff options
| author | Karthik Nayak <karthik.188@gmail.com> | 2024-12-16 17:44:26 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-16 09:45:32 -0800 |
| commit | 1a83e26d72eb2601798dfc07e6f5112964dc9413 (patch) | |
| tree | 487b8ddabd49d1a5fa8193f89bb279b61bc619b2 /refs/reftable-backend.c | |
| parent | Merge branch 'kn/reftable-writer-log-write-verify' into kn/reflog-migration (diff) | |
| download | git-1a83e26d72eb2601798dfc07e6f5112964dc9413.tar.gz git-1a83e26d72eb2601798dfc07e6f5112964dc9413.zip | |
refs: include committer info in `ref_update` struct
The reference backends obtain the committer information from
`git_committer_info(0)` when adding a reflog. The upcoming patches
introduce support for migrating reflogs between the reference backends.
This requires an interface to creating reflogs, including custom
committer information.
Add a new field `committer_info` to the `ref_update` struct, which is
then used by the reference backends. If there is no `committer_info`
provided, the reference backends default to using
`git_committer_info(0)`. The field itself cannot be set to
`git_committer_info(0)` since the values are dynamic and must be
obtained right when the reflog is being committed.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
| -rw-r--r-- | refs/reftable-backend.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index 647ef9b05b..e882602487 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -1379,11 +1379,21 @@ static int write_transaction_table(struct reftable_writer *writer, void *cb_data } if (create_reflog) { + struct ident_split c; + ALLOC_GROW(logs, logs_nr + 1, logs_alloc); log = &logs[logs_nr++]; memset(log, 0, sizeof(*log)); - fill_reftable_log_record(log, &committer_ident); + if (u->committer_info) { + if (split_ident_line(&c, u->committer_info, + strlen(u->committer_info))) + BUG("failed splitting committer info"); + } else { + c = committer_ident; + } + + fill_reftable_log_record(log, &c); log->update_index = ts; log->refname = xstrdup(u->refname); memcpy(log->value.update.new_hash, |
