git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>, git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] sequencer: remove unreachable exit condition in pick_commits()
Date: Tue, 12 Sep 2023 11:18:35 +0100	[thread overview]
Message-ID: <ddf8dc95-6583-4257-b48a-0115f59950ef@gmail.com> (raw)
In-Reply-To: <20230903151132.739151-1-oswald.buddenhagen@gmx.de>

Hi Oswald

On 03/09/2023 16:11, Oswald Buddenhagen wrote:
> This was introduced by 56dc3ab04 ("sequencer (rebase -i): implement the
> 'edit' command", 2017-01-02), and was pointless from the get-go, as the
> command causes an early return.

While I agree this code is unreachable, just because it was unused when 
it was added does not mean it is unused now. It would be helpful for the 
commit message to explain that there are no "break" or "goto" statements 
in the loop body and therefore this code is only reachable when the loop 
terminates because todo_list->current == todo_list->nr

Best Wishes

Phillip

> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
> 
> ---
> this remains valid after phillip's pending series, through it becomes
> marginally harder to prove (c.f. "sequencer: factor out part of
> pick_commits()").
> 
> Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
> Cc: Phillip Wood <phillip.wood123@gmail.com>
> ---
>   sequencer.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index a66dcf8ab2..99e9c520ca 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -4832,10 +4832,6 @@ static int pick_commits(struct repository *r,
>   		struct strbuf head_ref = STRBUF_INIT, buf = STRBUF_INIT;
>   		struct stat st;
>   
> -		/* Stopped in the middle, as planned? */
> -		if (todo_list->current < todo_list->nr)
> -			return 0;
> -
>   		if (read_oneliner(&head_ref, rebase_path_head_name(), 0) &&
>   				starts_with(head_ref.buf, "refs/")) {
>   			const char *msg;



  reply	other threads:[~2023-09-12 10:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-03 15:11 [PATCH] sequencer: remove unreachable exit condition in pick_commits() Oswald Buddenhagen
2023-09-12 10:18 ` Phillip Wood [this message]
2023-09-12 10:55   ` [PATCH v2] " Oswald Buddenhagen
2023-09-12 13:27     ` Phillip Wood
2023-09-13  0:32       ` 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=ddf8dc95-6583-4257-b48a-0115f59950ef@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=oswald.buddenhagen@gmx.de \
    --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).