int autosquash;
char *gpg_sign_opt;
int autostash;
+ char *cmd;
};
static int is_interactive(struct rebase_options *opts)
add_var(&script_snippet, "keep_empty", opts->keep_empty ? "yes" : "");
add_var(&script_snippet, "autosquash", opts->autosquash ? "t" : "");
add_var(&script_snippet, "gpg_sign_opt", opts->gpg_sign_opt);
+ add_var(&script_snippet, "cmd", opts->cmd);
switch (opts->type) {
case REBASE_AM:
const char *gpg_sign = NULL;
int opt_c = -1;
struct string_list whitespace = STRING_LIST_INIT_NODUP;
+ struct string_list exec = STRING_LIST_INIT_NODUP;
struct option builtin_rebase_options[] = {
OPT_STRING(0, "onto", &options.onto_name,
N_("revision"),
REBASE_AM),
OPT_BOOL(0, "autostash", &options.autostash,
N_("automatically stash/stash pop before and after")),
+ OPT_STRING_LIST('x', "exec", &exec, N_("exec"),
+ N_("add exec lines after each commit of the "
+ "editable list")),
OPT_END(),
};
}
}
+ if (exec.nr) {
+ int i;
+
+ 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);
+ }
+
switch (options.type) {
case REBASE_MERGE:
case REBASE_INTERACTIVE:
strbuf_release(&revisions);
free(options.head_name);
free(options.gpg_sign_opt);
+ free(options.cmd);
return ret;
}