1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-07 05:46:08 +02:00

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>
This commit is contained in:
Jeff King 2023-07-03 02:44:16 -04:00 committed by Junio C Hamano
parent 506d35f13d
commit cc88afad62
4 changed files with 5 additions and 7 deletions

View File

@ -99,7 +99,7 @@ static const char diff_tree_usage[] =
" --root include the initial commit as diff against /dev/null\n"
COMMON_DIFF_OPTIONS_HELP;
static void diff_tree_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt)
static void diff_tree_tweak_rev(struct rev_info *rev)
{
if (!rev->diffopt.output_format) {
if (rev->dense_combined_merges)

View File

@ -719,8 +719,7 @@ static int show_tree_object(const struct object_id *oid UNUSED,
return 0;
}
static void show_setup_revisions_tweak(struct rev_info *rev,
struct setup_revision_opt *opt)
static void show_setup_revisions_tweak(struct rev_info *rev)
{
if (rev->first_parent_only)
diff_merges_default_to_first_parent(rev);
@ -863,8 +862,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
return cmd_log_deinit(cmd_log_walk(&rev), &rev);
}
static void log_setup_revisions_tweak(struct rev_info *rev,
struct setup_revision_opt *opt)
static void log_setup_revisions_tweak(struct rev_info *rev)
{
if (rev->diffopt.flags.default_follow_renames &&
diff_check_follow_pathspec(&rev->prune_data, 0))

View File

@ -2971,7 +2971,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
if (!revs->def)
revs->def = opt ? opt->def : NULL;
if (opt && opt->tweak)
opt->tweak(revs, opt);
opt->tweak(revs);
if (revs->show_merge)
prepare_show_merge(revs);
if (revs->def && !revs->pending.nr && !revs->rev_input_given) {

View File

@ -428,7 +428,7 @@ void repo_init_revisions(struct repository *r,
*/
struct setup_revision_opt {
const char *def;
void (*tweak)(struct rev_info *, struct setup_revision_opt *);
void (*tweak)(struct rev_info *);
unsigned int assume_dashdash:1,
allow_exclude_promisor_objects:1,
free_removed_argv_elements:1;