From: kristofferhaugsbakk@fastmail.com Date: Sun, 04 Oct 2026 10:17:53 GMT Subject: [PATCH v4 1/2] format-patch: simplify get_notes_arg parameters Message-ID: In-Reply-To: From: Kristoffer Haugsbakk 85bd88a7 (revision: add rdiff_log_arg to rev_info, 2025-09-25) added `rdiff_log_arg` to `struct rev_info`. `get_notes_arg` was changed to take a second parameter, namely that member: get_notes_args(&(rev.rdiff_log_arg), &rev); But this is obviously unnecessary; we can just use `&rev`. Now is also a good time to format this `for_each...` line since it’s gotten quite long. Signed-off-by: Kristoffer Haugsbakk --- Notes (series): v4: • Shorter commit message. No I.[1] 🔗 1: https://lore.kernel.org/git/CV_format-patch_learn_--range-diff-notes.c57@msgid.xyz/T/#mfbb107570d497be5bfe54fe209014b607f5d5830 Notes (testing): v1: just compile tested builtin/log.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 350b35c5563..560af00e2fd 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1333,16 +1333,18 @@ static int get_notes_refs(struct string_list_item *item, void *arg) return 0; } -static void get_notes_args(struct strvec *arg, struct rev_info *rev) +static void get_notes_args(struct rev_info *rev) { if (!rev->show_notes) { - strvec_push(arg, "--no-notes"); + strvec_push(&rev->rdiff_log_arg, "--no-notes"); } else if (rev->notes_opt.use_default_notes > 0 || (rev->notes_opt.use_default_notes == -1 && !rev->notes_opt.extra_notes_refs.nr)) { - strvec_push(arg, "--notes"); + strvec_push(&rev->rdiff_log_arg, "--notes"); } else { - for_each_string_list(&rev->notes_opt.extra_notes_refs, get_notes_refs, arg); + for_each_string_list(&rev->notes_opt.extra_notes_refs, + get_notes_refs, + &rev->rdiff_log_arg); } } @@ -2404,7 +2406,7 @@ int cmd_format_patch(int argc, rev.rdiff_title = diff_title(&rdiff_title, reroll_count, _("Range-diff:"), _("Range-diff against v%d:")); - get_notes_args(&(rev.rdiff_log_arg), &rev); + get_notes_args(&rev); } /* -- 2.55.0.793.gc667de3f2c5