From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
To: git@vger.kernel.org, GGG <gitgitgadget@gmail.com>
Cc: "D. Ben Knoble" <ben.knoble@gmail.com>,
"Harald Nordgren" <haraldnordgren@gmail.com>
Subject: Re: [PATCH v2 3/3] reflog: add --historical-branch to name the branch of each entry
Date: Sun, 25 Oct 2026 20:18:31 +0100 [thread overview]
Message-ID: <8ffe4cb4-fd89-4086-945b-735316e6d501@app.fastmail.com> (raw)
In-Reply-To: <aa5a98b80d2682cc0fa321c091c76e483fb6810f.1792348037.git.gitgitgadget@gmail.com>
On Sun, Oct 18, 2026, at 20:27, Harald Nordgren via GitGitGadget wrote:
> From: Harald Nordgren <haraldnordgren@gmail.com>
>[snip]
> diff --git a/reflog-walk.c b/reflog-walk.c
>[snip]
> static struct complete_reflogs *read_complete_reflog(const char *ref)
> {
> struct complete_reflogs *reflogs =
> @@ -178,13 +257,16 @@ void init_reflog_walk(struct reflog_walk_info **info)
> (*info)->complete_reflogs.strdup_strings = 1;
> }
>
> -void reflog_walk_mark(struct reflog_walk_info *info, bool operations)
> +void reflog_walk_mark(struct reflog_walk_info *info, bool operations,
> + bool historical_branch)
> {
> struct string_list_item *item;
>
> for_each_string_list_item(item, &info->complete_reflogs) {
> if (operations)
> mark_operations(item->util);
This was from the previous commit. A function that uses a `bool` param,
iterates/walks over a list, and then *if* `operations` is `true` (1)
calls a function, that looks weird to me. You’re either going to do it
to every item or just walk the list without doing anything.
> + if (historical_branch)
> + mark_branches(item->util);
But now you have two `bool` and you do two checks.
This is less weird to my eyes but these conditions inside a for-each
construct/macro still looks like a bad approach. Can’t you check each
condition and then call for-each with an unconditional `mark_branches`
for each item?
if (cond)
for-each item in items
fun(item)
> }
> }
>
> @@ -287,6 +369,16 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
> return 0;
> }
>[snip]
next prev parent reply other threads:[~2026-10-25 19:18 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 13:13 [PATCH 0/3] reflog: add --operations and --historical-branch Harald Nordgren via GitGitGadget
2026-10-15 13:13 ` [PATCH 1/3] reflog: name the strings that mark switches, renames and rebase steps Harald Nordgren via GitGitGadget
2026-10-15 14:35 ` Kristoffer Haugsbakk
2026-10-15 20:52 ` Harald Nordgren
2026-10-15 13:13 ` [PATCH 2/3] reflog: add --operations to show one entry per command Harald Nordgren via GitGitGadget
2026-10-15 13:13 ` [PATCH 3/3] reflog: add --historical-branch to name the branch of each entry Harald Nordgren via GitGitGadget
2026-10-15 14:36 ` [PATCH 0/3] reflog: add --operations and --historical-branch Kristoffer Haugsbakk
2026-10-15 15:24 ` Harald Nordgren
2026-10-15 15:35 ` Kristoffer Haugsbakk
2026-10-15 20:47 ` Harald Nordgren
2026-10-16 18:26 ` D. Ben Knoble
2026-10-23 15:31 ` Harald Nordgren
2026-10-16 18:36 ` D. Ben Knoble
2026-10-17 10:03 ` Harald Nordgren
2026-10-18 18:27 ` [PATCH v2 " Harald Nordgren via GitGitGadget
2026-10-18 18:27 ` [PATCH v2 1/3] reflog: name the strings that mark switches, renames and rebase steps Harald Nordgren via GitGitGadget
2026-10-23 21:19 ` Junio C Hamano
2026-10-23 22:47 ` Harald Nordgren
2026-10-23 22:55 ` Junio C Hamano
2026-10-18 18:27 ` [PATCH v2 2/3] reflog: add --operations to show one entry per command Harald Nordgren via GitGitGadget
2026-10-18 18:27 ` [PATCH v2 3/3] reflog: add --historical-branch to name the branch of each entry Harald Nordgren via GitGitGadget
2026-10-25 19:18 ` Kristoffer Haugsbakk [this message]
2026-10-25 20:22 ` Harald Nordgren
2026-10-26 8:39 ` Kristoffer Haugsbakk
2026-10-26 8:42 ` Harald Nordgren
2026-10-23 15:32 ` [PATCH v2 0/3] reflog: add --operations and --historical-branch Harald Nordgren
2026-10-24 13:51 ` Phillip Wood
2026-10-24 15:22 ` D. Ben Knoble
2026-10-24 16:40 ` Junio C Hamano
2026-10-24 18:46 ` Harald Nordgren
2026-10-25 18:52 ` Kristoffer Haugsbakk
2026-10-26 10:52 ` Phillip Wood
2026-10-26 11:00 ` Harald Nordgren
2026-10-26 15:07 ` Junio C Hamano
2026-10-24 19:12 ` Harald Nordgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ffe4cb4-fd89-4086-945b-735316e6d501@app.fastmail.com \
--to=kristofferhaugsbakk@fastmail.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=haraldnordgren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox