revisions: drop unused "opt" parameter in "tweak" callbacks

The setup_revision_opt struct has a "tweak" function pointer, which can be used to adjust parameters after setup_revisions() parses arguments, but before it finalizes setup. In addition to the rev_info struct, the callback receives a pointer to the setup_revision_opt, as well. But none of the existing callbacks looks at the extra "opt" parameter, leading to -Wunused-parameter warnings. We could mark it as UNUSED, but instead let's remove it entirely. It's conceivable that it could be useful for a callback to have access to the "opt" struct. But in the 13 years that this mechanism has existed, nobody has used it. So let's just drop it in the name of simplifying. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 3, 2023 at 02:44 UTC cc88afad622b8166563cc6bd68de3155ec558ab0
4 files changed +5 -7
builtin/diff-tree.c
+1 -1
@@ -99,7 +99,7 @@ static const char diff_tree_usage[] =
99 " --root include the initial commit as diff against /dev/null\n"
100 COMMON_DIFF_OPTIONS_HELP;
101
102 -static void diff_tree_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt)
102 +static void diff_tree_tweak_rev(struct rev_info *rev)
103 {
104 if (!rev->diffopt.output_format) {
105 if (rev->dense_combined_merges)
builtin/log.c
+2 -4
@@ -719,8 +719,7 @@ static int show_tree_object(const struct object_id *oid UNUSED,
719 return 0;
720 }
721
722 -static void show_setup_revisions_tweak(struct rev_info *rev,
723 - struct setup_revision_opt *opt)
722 +static void show_setup_revisions_tweak(struct rev_info *rev)
723 {
724 if (rev->first_parent_only)
725 diff_merges_default_to_first_parent(rev);
@@ -863,8 +862,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
862 return cmd_log_deinit(cmd_log_walk(&rev), &rev);
863 }
864
866 -static void log_setup_revisions_tweak(struct rev_info *rev,
867 - struct setup_revision_opt *opt)
865 +static void log_setup_revisions_tweak(struct rev_info *rev)
866 {
867 if (rev->diffopt.flags.default_follow_renames &&
868 diff_check_follow_pathspec(&rev->prune_data, 0))
revision.c
+1 -1
@@ -2971,7 +2971,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
2971 if (!revs->def)
2972 revs->def = opt ? opt->def : NULL;
2973 if (opt && opt->tweak)
2974 - opt->tweak(revs, opt);
2974 + opt->tweak(revs);
2975 if (revs->show_merge)
2976 prepare_show_merge(revs);
2977 if (revs->def && !revs->pending.nr && !revs->rev_input_given) {
revision.h
+1 -1
@@ -428,7 +428,7 @@ void repo_init_revisions(struct repository *r,
428 */
429 struct setup_revision_opt {
430 const char *def;
431 - void (*tweak)(struct rev_info *, struct setup_revision_opt *);
431 + void (*tweak)(struct rev_info *);
432 unsigned int assume_dashdash:1,
433 allow_exclude_promisor_objects:1,
434 free_removed_argv_elements:1;