diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-02-21 13:37:39 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-21 18:58:06 +0100 |
commit | 31f898397bb2f44692b8bcc4fd64fffaf3b59c48 (patch) | |
tree | b6d732741f5215ef054185159df36df22190a4de /builtin/reflog.c | |
parent | refs: always treat iterators as ordered (diff) | |
download | git-31f898397bb2f44692b8bcc4fd64fffaf3b59c48.tar.xz git-31f898397bb2f44692b8bcc4fd64fffaf3b59c48.zip |
refs: drop unused params from the reflog iterator callback
The ref and reflog iterators share much of the same underlying code to
iterate over the corresponding entries. This results in some weird code
because the reflog iterator also exposes an object ID as well as a flag
to the callback function. Neither of these fields do refer to the reflog
though -- they refer to the corresponding ref with the same name. This
is quite misleading. In practice at least the object ID cannot really be
implemented in any other way as a reflog does not have a specific object
ID in the first place. This is further stressed by the fact that none of
the callbacks except for our test helper make use of these fields.
Split up the infrastucture so that ref and reflog iterators use separate
callback signatures. This allows us to drop the nonsensical fields from
the reflog iterator.
Note that internally, the backends still use the same shared infra to
iterate over both types. As the backends should never end up being
called directly anyway, this is not much of a problem and thus kept
as-is for simplicity's sake.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/reflog.c')
-rw-r--r-- | builtin/reflog.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c index a5a4099f61..3a0c4d4322 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -60,8 +60,7 @@ struct worktree_reflogs { struct string_list reflogs; }; -static int collect_reflog(const char *ref, const struct object_id *oid UNUSED, - int flags UNUSED, void *cb_data) +static int collect_reflog(const char *ref, void *cb_data) { struct worktree_reflogs *cb = cb_data; struct worktree *worktree = cb->worktree; |