Hi Phillip,
On Tue, 29 Jan 2019, Phillip Wood wrote:
> Range-diff against v1:
> 1: 9626549aec ! 1: 726b84c300 rebase -x: sanity check command
> @@ -2,8 +2,9 @@
>
> rebase -x: sanity check command
>
> - If the user gives an empty argument to --exec then the rebase starts
> to
> - run before erroring out with
> + If the user gives an empty argument to --exec then git creates a todo
> + list that it cannot parse. The rebase starts to run before erroring
> out
> + with
>
> error: missing arguments for exec
> error: invalid line 2: exec
> @@ -33,21 +34,16 @@
>
> +static int check_exec_cmd(const char *cmd)
> +{
> -+ int non_blank = 0;
> ++ if (strchr(cmd, '\n'))
> ++ return error(_("exec commands cannot contain
> newlines"));
> +
> -+ while (*cmd) {
> -+ if (*cmd == '\n')
> -+ return error(_("exec commands cannot contain
> newlines"));
> -+ if (!isspace(*cmd))
> -+ non_blank = 1;
> -+ cmd++;
> -+ }
> ++ /* Does the command consist purely of whitespace? */
> ++ if (!cmd[strspn(cmd, " \t\r\f\v")])
> ++ return error(_("empty exec command"));
> +
> -+ if (non_blank)
> -+ return 0;
> -+
> -+ return error(_("empty exec command"));
> ++ return 0;
> +}
> ++
> +
> int cmd_rebase(int argc, const char **argv, const char *prefix)
> {
Looks great!
Thanks,
Dscho