git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/6] log-tree: drop unused commit param in remerge_diff()

From
Elijah Newren <newren@gmail.com>
Date
Aug 19, 2022, 23:05 UTC
Message-ID
<CABPp-BHvscxV+vVL-Tew2H4h8V_3bZpD0Qz9uEMwrV=X3zrYSg@mail.gmail.com>
In-Reply-To
<Yv9O2RK7ahmw5ge7@coredump.intra.peff.net>
On Fri, Aug 19, 2022 at 1:50 AM Jeff King <peff@peff.net> wrote:
Show 41 quoted lines
>
> This function has never used its "commit" parameter since it was added
> in db757e8b8d (show, log: provide a --remerge-diff capability,
> 2022-02-02).
>
> This makes sense; we already have separate parameters for the parents
> (which lets us redo the merge) and the oid of the result tree (which we
> can then diff against the remerge result).
>
> Let's drop the unused parameter in the name of clarity.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  log-tree.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/log-tree.c b/log-tree.c
> index d0ac0a6327..82d9b5f650 100644
> --- a/log-tree.c
> +++ b/log-tree.c
> @@ -956,8 +956,7 @@ static void cleanup_additional_headers(struct diff_options *o)
>
>  static int do_remerge_diff(struct rev_info *opt,
>                            struct commit_list *parents,
> -                          struct object_id *oid,
> -                          struct commit *commit)
> +                          struct object_id *oid)
>  {
>         struct merge_options o;
>         struct commit_list *bases;
> @@ -1052,7 +1051,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
>                                         "for octopus merges.\n");
>                                 return 1;
>                         }
> -                       return do_remerge_diff(opt, parents, oid, commit);
> +                       return do_remerge_diff(opt, parents, oid);
>                 }
>                 if (opt->combine_merges)
>                         return do_diff_combined(opt, commit);
> --
> 2.37.2.928.g0821088f4a

Yeah, looks like I could have just used commit instead of parents and oid, but since the calling code had those handy, I added them directly and forgot to remove commit.

Patch looks good.
Previous: Jeff KingNext: Jeff King
Message 8 of 21 in “unused function parameter potpourri”
  1. 0/6 unused function parameter potpourriJeff King, Aug 19, 2022
  2. 1/6 xdiff: drop unused mmfile parameters from xdl_do_histogram_diff()Jeff King, Aug 19, 2022
  3. Phillip WoodAug 19, 2022
  4. Jeff KingAug 20, 2022
  5. 7/6 xdiff: drop unused mmfile parameters from xdl_do_patience_diff()Jeff King, Aug 20, 2022
  6. Phillip WoodAug 26, 2022
  7. 2/6 log-tree: drop unused commit param in remerge_diff()Jeff King, Aug 19, 2022
  8. Elijah NewrenAug 19, 2022
  9. Jeff KingAug 20, 2022
  10. 3/6 match_pathname(): drop unused "flags" parameterJeff King, Aug 19, 2022
  11. 4/6 verify_one_sparse(): drop unused repository parameterJeff King, Aug 19, 2022
  12. Derrick StoleeAug 19, 2022
  13. Jeff KingAug 20, 2022
  14. René ScharfeAug 20, 2022
  15. 4/6 verify_one_sparse(): drop unused repository parameterJeff King, Aug 20, 2022
  16. 5/6 reftable: drop unused parameter from reader_seek_linear()Jeff King, Aug 19, 2022
  17. Derrick StoleeAug 19, 2022
  18. Han-Wen NienhuysAug 22, 2022
  19. 6/6 reflog: assert PARSE_OPT_NONEG in parse-options callbacksJeff King, Aug 19, 2022
  20. Derrick StoleeAug 19, 2022
  21. Elijah NewrenAug 19, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.