git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Andrei Rybak <rybak.a.v@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] rebase: prepare cmd before choosing action
Date: Fri, 15 Nov 2019 14:49:07 +0900	[thread overview]
Message-ID: <xmqqk1817kq4.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20191114163549.7648-2-rybak.a.v@gmail.com> (Andrei Rybak's message of "Thu, 14 Nov 2019 17:35:47 +0100")

Andrei Rybak <rybak.a.v@gmail.com> writes:

> 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.

> +		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);
> +	}
> +

  reply	other threads:[~2019-11-15  5:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 16:35 [PATCH 0/3] rebase --edit-todo --exec Andrei Rybak
2019-11-14 16:35 ` [PATCH 1/3] rebase: prepare cmd before choosing action Andrei Rybak
2019-11-15  5:49   ` Junio C Hamano [this message]
2019-11-14 16:35 ` [PATCH 2/3] rebase: extract add_exec() Andrei Rybak
2019-11-14 16:35 ` [PATCH 3/3] rebase -i: allow --edit-todo with --exec Andrei Rybak
2019-11-20  9:52 ` [RFC PATCH v2 0/4] rebase --edit-todo --exec Andrei Rybak
2019-11-20  9:52 ` [RFC PATCH v2 1/4] builtin/rebase.c: reuse loop variable Andrei Rybak
2019-11-21  1:30   ` Junio C Hamano
2019-11-20  9:52 ` [RFC PATCH v2 2/4] rebase: prepare cmd before choosing action Andrei Rybak
2019-11-21  2:00   ` Junio C Hamano
2019-11-22 19:08     ` Andrei Rybak
2019-11-20  9:52 ` [RFC PATCH v2 3/4] rebase: extract add_exec() Andrei Rybak
2019-11-20  9:52 ` [RFC PATCH v2 4/4] rebase -i: allow --edit-todo with --exec Andrei Rybak

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqk1817kq4.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rybak.a.v@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).