]> Kevux Git Server - rit/commit
builtin/reflog: implement subcommand to write new entries
authorPatrick Steinhardt <ps@pks.im>
Wed, 6 Aug 2025 05:54:15 +0000 (07:54 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Aug 2025 14:36:30 +0000 (07:36 -0700)
commit7aa619c36f4d6ba5710f7273739655914e65d9c5
treea0157bc4a32d94ac815d0599b8f04bba02d3fb49
parent1ffd2d41599e2b506f20430914e3bc53a0e05f3a
builtin/reflog: implement subcommand to write new entries

While we provide a couple of subcommands in git-reflog(1) to remove
reflog entries, we don't provide any to write new entries. Obviously
this is not an operation that really would be needed for many use cases
out there, or otherwise people would have complained that such a command
does not exist yet. But the introduction of the "reftable" backend
changes the picture a bit, as it is now basically impossible to manually
append a reflog entry if one wanted to do so due to the binary format.

Plug this gap by introducing a simple "write" subcommand. For now, all
this command does is to append a single new reflog entry with the given
object IDs and message to the reflog. More specifically, it is not yet
possible to:

  - Write multiple reflog entries at once.

  - Insert reflog entries at arbitrary indices.

  - Specify the date of the reflog entry.

  - Insert reflog entries that refer to nonexistent objects.

If required, those features can be added at a future point in time. For
now though, the new command aims to fulfill the most basic use cases
while being as strict as possible when it comes to verifying parameters.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-reflog.adoc
builtin/reflog.c
t/meson.build
t/t1421-reflog-write.sh [new file with mode: 0755]