git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Jeff King <peff@peff.net>, git@vger.kernel.org
Cc: Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH 02/22] sequencer: mark repository argument as unused
Date: Tue, 29 Aug 2023 16:55:30 +0100	[thread overview]
Message-ID: <e65c93ec-0221-492b-b538-450b60cf1e59@gmail.com> (raw)
In-Reply-To: <20230828214717.GB3831137@coredump.intra.peff.net>

Hi Peff

On 28/08/2023 22:47, Jeff King wrote:
> In sequencer_get_last_command(), we don't ever look at the repository
> parameter. It _should_ be used when calling into git_path_* functions,
> but the one we use here is declared with the non-REPO variant of
> GIT_PATH_FUNC(), and so just uses the_repository internally.
> 
> We could change the path helper to use REPO_GIT_PATH_FUNC(), but doing
> so piecemeal is not great. There are 41 uses of GIT_PATH_FUNC() in
> sequencer.c,

Wow, I knew there were quite a few but I hadn't realized there were that 
many. Changing them all to take a struct repository will be a big change 
and will make struct repo_cache_path a lot larger.

> and inconsistently switching one makes the code more
> confusing. Likewise, this one function is used in half a dozen other
> spots, all of which would need to start passing in a repository argument
> (with rippling effects up the call stack).
> 
> So let's punt on that for now and just silence any -Wunused-parameter
> warning.
> 
> Note that we could also drop this parameter entirely, as the function is
> always called directly, and not as a callback that has to conform to
> some external interface. But since we'd eventually want to use the
> repository parameter, let's leave it in place to avoid disrupting the
> callers twice.

I think that makes sense as we're going to need that argument 
eventually. I was curious as to why this function takes a repository 
argument. When the function was added in 4a72486de97 (fix 
cherry-pick/revert status after commit, 2019-04-16) it called 
parse_insn_line() which takes a repository argument. It was refactored 
in ed5b1ca10b (status: do not report errors in sequencer/todo, 
2019-06-27) and I failed to notice that the repository was unused 
afterwards.

Best Wishes

Phillip


> Signed-off-by: Jeff King <peff@peff.net>
> ---
>   sequencer.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index 82dc3e160e..41fd79d215 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -2649,7 +2649,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
>   	return item->commit ? 0 : -1;
>   }
>   
> -int sequencer_get_last_command(struct repository *r, enum replay_action *action)
> +int sequencer_get_last_command(struct repository *r UNUSED, enum replay_action *action)
>   {
>   	const char *todo_file, *bol;
>   	struct strbuf buf = STRBUF_INIT;

  parent reply	other threads:[~2023-08-29 15:56 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 21:46 [PATCH 0/22] YAUPS: Yet Another Unused Parameter Series Jeff King
2023-08-28 21:46 ` [PATCH 01/22] sequencer: use repository parameter in short_commit_name() Jeff King
2023-08-28 22:21   ` Junio C Hamano
2023-08-28 23:06     ` Taylor Blau
2023-08-29  0:48     ` Jeff King
2023-08-29  1:16       ` Junio C Hamano
2023-08-28 21:47 ` [PATCH 02/22] sequencer: mark repository argument as unused Jeff King
2023-08-28 23:24   ` Taylor Blau
2023-08-29 15:55   ` Phillip Wood [this message]
2023-08-29 23:32     ` Jeff King
2023-08-30 13:35       ` Phillip Wood
2023-08-28 21:47 ` [PATCH 03/22] ref-filter: mark unused parameters in parser callbacks Jeff King
2023-08-28 21:47 ` [PATCH 04/22] pack-bitmap: mark unused parameters in show_object callback Jeff King
2023-08-28 21:47 ` [PATCH 05/22] worktree: mark unused parameters in each_ref_fn callback Jeff King
2023-08-28 21:47 ` [PATCH 06/22] commit-graph: mark unused data parameters in generation callbacks Jeff King
2023-08-28 23:32   ` Taylor Blau
2023-08-29  0:52     ` Jeff King
2023-08-28 21:47 ` [PATCH 07/22] ls-tree: mark unused parameter in callback Jeff King
2023-08-28 21:47 ` [PATCH 08/22] stash: mark unused parameter in diff callback Jeff King
2023-08-28 21:47 ` [PATCH 09/22] trace2: mark unused us_elapsed_absolute parameters Jeff King
2023-08-28 21:47 ` [PATCH 10/22] trace2: mark unused config callback parameter Jeff King
2023-08-28 21:47 ` [PATCH 11/22] test-trace2: mark unused argv/argc parameters Jeff King
2023-08-28 21:47 ` [PATCH 12/22] grep: mark unused parameter in output function Jeff King
2023-08-28 21:48 ` [PATCH 13/22] add-interactive: mark unused callback parameters Jeff King
2023-08-28 21:48 ` [PATCH 14/22] negotiator/noop: " Jeff King
2023-08-28 21:48 ` [PATCH 15/22] worktree: mark unused parameters in noop repair callback Jeff King
2023-08-28 21:48 ` [PATCH 16/22] imap-send: mark unused parameters with NO_OPENSSL Jeff King
2023-08-28 21:48 ` [PATCH 17/22] grep: mark unused parmaeters in pcre fallbacks Jeff King
2023-08-28 21:48 ` [PATCH 18/22] credential: mark unused parameter in urlmatch callback Jeff King
2023-08-28 21:48 ` [PATCH 19/22] fetch: mark unused parameter in ref_transaction callback Jeff King
2023-08-28 21:48 ` [PATCH 20/22] bundle-uri: mark unused parameters in callbacks Jeff King
2023-08-28 21:48 ` [PATCH 21/22] gc: mark unused descriptors in scheduler callbacks Jeff King
2023-08-28 21:48 ` [PATCH 22/22] update-ref: mark unused parameter in parser callbacks Jeff King
2023-08-28 23:35 ` [PATCH 0/22] YAUPS: Yet Another Unused Parameter Series Taylor Blau
2023-08-29 23:43 ` [PATCH v2 0/22] " Jeff King
2023-08-29 23:43   ` [PATCH v2 01/22] sequencer: use repository parameter in short_commit_name() Jeff King
2023-08-30 13:24     ` Phillip Wood
2023-08-29 23:44   ` [PATCH v2 02/22] sequencer: mark repository argument as unused Jeff King
2023-08-29 23:45   ` [PATCH v2 03/22] ref-filter: mark unused parameters in parser callbacks Jeff King
2023-08-29 23:45   ` [PATCH v2 04/22] pack-bitmap: mark unused parameters in show_object callback Jeff King
2023-08-29 23:45   ` [PATCH v2 05/22] worktree: mark unused parameters in each_ref_fn callback Jeff King
2023-08-29 23:45   ` [PATCH v2 06/22] commit-graph: mark unused data parameters in generation callbacks Jeff King
2023-08-29 23:45   ` [PATCH v2 07/22] ls-tree: mark unused parameter in callback Jeff King
2023-08-29 23:45   ` [PATCH v2 08/22] stash: mark unused parameter in diff callback Jeff King
2023-08-29 23:45   ` [PATCH v2 09/22] trace2: mark unused us_elapsed_absolute parameters Jeff King
2023-08-29 23:45   ` [PATCH v2 10/22] trace2: mark unused config callback parameter Jeff King
2023-08-29 23:45   ` [PATCH v2 11/22] test-trace2: mark unused argv/argc parameters Jeff King
2023-08-29 23:45   ` [PATCH v2 12/22] grep: mark unused parameter in output function Jeff King
2023-08-29 23:45   ` [PATCH v2 13/22] add-interactive: mark unused callback parameters Jeff King
2023-08-29 23:45   ` [PATCH v2 14/22] negotiator/noop: " Jeff King
2023-08-29 23:45   ` [PATCH v2 15/22] worktree: mark unused parameters in noop repair callback Jeff King
2023-08-29 23:45   ` [PATCH v2 16/22] imap-send: mark unused parameters with NO_OPENSSL Jeff King
2023-08-29 23:45   ` [PATCH v2 17/22] grep: mark unused parmaeters in pcre fallbacks Jeff King
2023-08-29 23:45   ` [PATCH v2 18/22] credential: mark unused parameter in urlmatch callback Jeff King
2023-08-29 23:45   ` [PATCH v2 19/22] fetch: mark unused parameter in ref_transaction callback Jeff King
2023-08-29 23:45   ` [PATCH v2 20/22] bundle-uri: mark unused parameters in callbacks Jeff King
2023-08-29 23:45   ` [PATCH v2 21/22] gc: mark unused descriptors in scheduler callbacks Jeff King
2023-08-29 23:45   ` [PATCH v2 22/22] update-ref: mark unused parameter in parser callbacks Jeff King
2023-08-30  1:00   ` [PATCH v2 0/22] Yet Another Unused Parameter Series Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e65c93ec-0221-492b-b538-450b60cf1e59@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).