Re: [PATCH 2/4] refs: trim newline from reflog message
flat view
From: Han-Wen Nienhuys <hidden>
Date: 2021-11-23 16:45:44
On Tue, Nov 23, 2021 at 11:40 AM Ævar Arnfjörð Bjarmason [off-list ref] wrote:
I think your cleanup works, but wouldn't a better thing be to move this to callbacks rather than tweaking the fprintf formats?
sure. In the reftable glue, I have
if (!(flags & EXPIRE_REFLOGS_DRY_RUN)) {
/* XXX - skip writing records that were not changed. */
err = reftable_addition_commit(add);
} else {
/* XXX - print something */
}
letting the callbacks do the printing means less work for reftable.
The refs/files-backend.c shouldn't need to have one function calll the "should_prune_fn" *and* write out the data. Instead some code common to all backends should call the "should prune?", and then call the backend's "here's an entry for you to write" callback.
not sure if that will work. For reftable, you have to write something (a tombstone) if you _do_ want to prune the entry.
But maybe I'm overthinking this whole thing. I'm just wondering if we have say a sqlite reflog backend as opposed to the file/reftable backend that wants to store this data in a schema. Such a a backend would need
reftable also stores this in a schema: there are separate fields for e-mail, timezone, timestamp etc. -- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Halimah DeLaine Prado