const char *action;
int signoff;
int allow_rerere_autoupdate;
+ int keep_empty;
};
static int is_interactive(struct rebase_options *opts)
opts->type == REBASE_PRESERVE_MERGES;
}
+static void imply_interactive(struct rebase_options *opts, const char *option)
+{
+ switch (opts->type) {
+ case REBASE_AM:
+ die(_("%s requires an interactive rebase"), option);
+ break;
+ case REBASE_INTERACTIVE:
+ case REBASE_PRESERVE_MERGES:
+ break;
+ case REBASE_MERGE:
+ /* we silently *upgrade* --merge to --interactive if needed */
+ default:
+ opts->type = REBASE_INTERACTIVE; /* implied */
+ break;
+ }
+}
+
/* Returns the filename prefixed by the state_dir */
static const char *state_dir_path(const char *filename, struct rebase_options *opts)
{
opts->allow_rerere_autoupdate < 0 ? "" :
opts->allow_rerere_autoupdate ?
"--rerere-autoupdate" : "--no-rerere-autoupdate");
+ add_var(&script_snippet, "keep_empty", opts->keep_empty ? "yes" : "");
switch (opts->type) {
case REBASE_AM:
&options.allow_rerere_autoupdate,
N_("allow rerere to update index with resolved "
"conflict")),
+ OPT_BOOL('k', "keep-empty", &options.keep_empty,
+ N_("preserve empty commits during rebase")),
OPT_END(),
};
options.flags |= REBASE_FORCE;
}
+ if (options.keep_empty)
+ imply_interactive(&options, "--keep-empty");
+
switch (options.type) {
case REBASE_MERGE:
case REBASE_INTERACTIVE: