Re: [PATCH 1/3] rebase: prepare cmd before choosing action
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 15, 2019, 05:49 UTC
- Message-ID
- <xmqqk1817kq4.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20191114163549.7648-2-rybak.a.v@gmail.com>
Andrei Rybak <rybak.a.v@gmail.com> writes:
Show 14 quoted lines
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 4a20582e72..9457912f9d 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -1595,6 +1595,21 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
> trace2_cmd_mode(action_names[action]);
> }
>
> + for (i = 0; i < exec.nr; i++)
> + if (check_exec_cmd(exec.items[i].string))
> + exit(1);
> +
> + if (exec.nr) {
> + int i;This masks the outer "i" (I am assuming such a thing exists, judging from its use in the above loop you added), but I do not see a need for it. With or without this masked local "i", the value of outer "i" will be equal to exec.nr+1 after the control leaves this if block.
Show 8 quoted lines
> + imply_interactive(&options, "--exec"); > + > + strbuf_reset(&buf); > + for (i = 0; i < exec.nr; i++) > + strbuf_addf(&buf, "exec %s\n", exec.items[i].string); > + options.cmd = xstrdup(buf.buf); > + } > +