diff mbox series

[4/4] merge-ort: drop unused "opt" parameter from merge_check_renames_reusable()

Message ID 20230914094004.GD2254894@coredump.intra.peff.net (mailing list archive)
State Accepted
Commit 6eb0c0eb7ac23da7d3bc437b7a5c31f628c25531
Headers show
Series merge-ort unused parameter cleanups | expand

Commit Message

Jeff King Sept. 14, 2023, 9:40 a.m. UTC
The merge_options parameter has never been used since the function was
introduced in 64aceb6d73 (merge-ort: add code to check for whether
cached renames can be reused, 2021-05-20). In theory some merge options
might impact our decisions here, but that has never been the case so
far.

Let's drop it to appease -Wunused-parameter; it would be easy to add
back later if we need to (there is only one caller).

Signed-off-by: Jeff King <peff@peff.net>
---
 merge-ort.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Elijah Newren Sept. 16, 2023, 3:09 a.m. UTC | #1
On Thu, Sep 14, 2023 at 2:40 AM Jeff King <peff@peff.net> wrote:
>
> The merge_options parameter has never been used since the function was
> introduced in 64aceb6d73 (merge-ort: add code to check for whether
> cached renames can be reused, 2021-05-20). In theory some merge options
> might impact our decisions here, but that has never been the case so
> far.

Yeah, it was used in some preliminary versions of the code while I was
developing the new algorithm, but there were lots of changes between
when I started working on merge-ort and when it was finally ready to
submit for review.  I must have just overlooked that this parameter
was no longer needed.  Thanks for catching and cleaning up.

> Let's drop it to appease -Wunused-parameter; it would be easy to add
> back later if we need to (there is only one caller).

Yep, makes sense.


> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  merge-ort.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/merge-ort.c b/merge-ort.c
> index 20eefd9b5e..3953c9f745 100644
> --- a/merge-ort.c
> +++ b/merge-ort.c
> @@ -4880,8 +4880,7 @@ static void merge_start(struct merge_options *opt, struct merge_result *result)
>         trace2_region_leave("merge", "allocate/init", opt->repo);
>  }
>
> -static void merge_check_renames_reusable(struct merge_options *opt,
> -                                        struct merge_result *result,
> +static void merge_check_renames_reusable(struct merge_result *result,
>                                          struct tree *merge_base,
>                                          struct tree *side1,
>                                          struct tree *side2)
> @@ -5083,7 +5082,7 @@ void merge_incore_nonrecursive(struct merge_options *opt,
>
>         trace2_region_enter("merge", "merge_start", opt->repo);
>         assert(opt->ancestor != NULL);
> -       merge_check_renames_reusable(opt, result, merge_base, side1, side2);
> +       merge_check_renames_reusable(result, merge_base, side1, side2);
>         merge_start(opt, result);
>         /*
>          * Record the trees used in this merge, so if there's a next merge in
> --
> 2.42.0.628.g8a27295885
Jeff King Sept. 16, 2023, 5:52 a.m. UTC | #2
On Fri, Sep 15, 2023 at 08:09:00PM -0700, Elijah Newren wrote:

> On Thu, Sep 14, 2023 at 2:40 AM Jeff King <peff@peff.net> wrote:
> >
> > The merge_options parameter has never been used since the function was
> > introduced in 64aceb6d73 (merge-ort: add code to check for whether
> > cached renames can be reused, 2021-05-20). In theory some merge options
> > might impact our decisions here, but that has never been the case so
> > far.
> 
> Yeah, it was used in some preliminary versions of the code while I was
> developing the new algorithm, but there were lots of changes between
> when I started working on merge-ort and when it was finally ready to
> submit for review.  I must have just overlooked that this parameter
> was no longer needed.  Thanks for catching and cleaning up.

Yeah, that's what I figured. I actually queued quite a few of these
-Wunused-parameter fixups, because the initial iterations of merge-ort
had a lot of stub functions or unimplemented bits. I sat on them for a
year or so because I figured you'd eventually use those parameters. And
indeed, most of them fell out naturally, and what was left for this
series was all pretty easy to understand.

-Peff
diff mbox series

Patch

diff --git a/merge-ort.c b/merge-ort.c
index 20eefd9b5e..3953c9f745 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -4880,8 +4880,7 @@  static void merge_start(struct merge_options *opt, struct merge_result *result)
 	trace2_region_leave("merge", "allocate/init", opt->repo);
 }
 
-static void merge_check_renames_reusable(struct merge_options *opt,
-					 struct merge_result *result,
+static void merge_check_renames_reusable(struct merge_result *result,
 					 struct tree *merge_base,
 					 struct tree *side1,
 					 struct tree *side2)
@@ -5083,7 +5082,7 @@  void merge_incore_nonrecursive(struct merge_options *opt,
 
 	trace2_region_enter("merge", "merge_start", opt->repo);
 	assert(opt->ancestor != NULL);
-	merge_check_renames_reusable(opt, result, merge_base, side1, side2);
+	merge_check_renames_reusable(result, merge_base, side1, side2);
 	merge_start(opt, result);
 	/*
 	 * Record the trees used in this merge, so if there's a next merge in