* [PATCH] sequencer: remove unreachable exit condition in pick_commits()
@ 2023-09-03 15:11 Oswald Buddenhagen
2023-09-12 10:18 ` Phillip Wood
0 siblings, 1 reply; 5+ messages in thread
From: Oswald Buddenhagen @ 2023-09-03 15:11 UTC (permalink / raw)
To: git; +Cc: Johannes Schindelin, Phillip Wood
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.
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;
--
2.40.0.152.g15d061e6df
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] sequencer: remove unreachable exit condition in pick_commits()
2023-09-03 15:11 [PATCH] sequencer: remove unreachable exit condition in pick_commits() Oswald Buddenhagen
@ 2023-09-12 10:18 ` Phillip Wood
2023-09-12 10:55 ` [PATCH v2] " Oswald Buddenhagen
0 siblings, 1 reply; 5+ messages in thread
From: Phillip Wood @ 2023-09-12 10:18 UTC (permalink / raw)
To: Oswald Buddenhagen, git; +Cc: Johannes Schindelin
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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] sequencer: remove unreachable exit condition in pick_commits()
2023-09-12 10:18 ` Phillip Wood
@ 2023-09-12 10:55 ` Oswald Buddenhagen
2023-09-12 13:27 ` Phillip Wood
0 siblings, 1 reply; 5+ messages in thread
From: Oswald Buddenhagen @ 2023-09-12 10:55 UTC (permalink / raw)
To: git; +Cc: Johannes Schindelin, Phillip Wood, Junio C Hamano
This was introduced by 56dc3ab04 ("sequencer (rebase -i): implement the
'edit' command", 2017-01-02), and was pointless from the get-go: all
early exits from the loop above are returns, so todo_list->current ==
todo_list->nr is an invariant after the loop.
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
---
v2:
- improved commit message
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: Phillip Wood <phillip.wood123@gmail.com>
Cc: Junio C Hamano <gitster@pobox.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;
--
2.42.0.419.g70bf8a5751
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] sequencer: remove unreachable exit condition in pick_commits()
2023-09-12 10:55 ` [PATCH v2] " Oswald Buddenhagen
@ 2023-09-12 13:27 ` Phillip Wood
2023-09-13 0:32 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Phillip Wood @ 2023-09-12 13:27 UTC (permalink / raw)
To: Oswald Buddenhagen, git; +Cc: Johannes Schindelin, Junio C Hamano
On 12/09/2023 11:55, 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: all
> early exits from the loop above are returns, so todo_list->current ==
> todo_list->nr is an invariant after the loop.
>
> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Thanks for updating the commit message, I think it is clearer now
Best Wishes
Phillip
> ---
> v2:
> - improved commit message
>
> Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
> Cc: Phillip Wood <phillip.wood123@gmail.com>
> Cc: Junio C Hamano <gitster@pobox.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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] sequencer: remove unreachable exit condition in pick_commits()
2023-09-12 13:27 ` Phillip Wood
@ 2023-09-13 0:32 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2023-09-13 0:32 UTC (permalink / raw)
To: Phillip Wood; +Cc: Oswald Buddenhagen, git, Johannes Schindelin
Phillip Wood <phillip.wood123@gmail.com> writes:
> On 12/09/2023 11:55, 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: all
>> early exits from the loop above are returns, so todo_list->current ==
>> todo_list->nr is an invariant after the loop.
>> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
>
> Thanks for updating the commit message, I think it is clearer now
Thanks, both. Queued.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-13 0:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-03 15:11 [PATCH] sequencer: remove unreachable exit condition in pick_commits() Oswald Buddenhagen
2023-09-12 10:18 ` Phillip Wood
2023-09-12 10:55 ` [PATCH v2] " Oswald Buddenhagen
2023-09-12 13:27 ` Phillip Wood
2023-09-13 0:32 ` Junio C Hamano
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).