struct strbuf git_am_opt;
const char *action;
int signoff;
+ int allow_rerere_autoupdate;
};
static int is_interactive(struct rebase_options *opts)
opts->flags |= REBASE_FORCE;
}
+ if (file_exists(state_dir_path("allow_rerere_autoupdate", opts))) {
+ strbuf_reset(&buf);
+ if (read_one(state_dir_path("allow_rerere_autoupdate", opts),
+ &buf))
+ return -1;
+ if (!strcmp(buf.buf, "--rerere-autoupdate"))
+ opts->allow_rerere_autoupdate = 1;
+ else if (!strcmp(buf.buf, "--no-rerere-autoupdate"))
+ opts->allow_rerere_autoupdate = 0;
+ else
+ warning(_("ignoring invalid allow_rerere_autoupdate: "
+ "'%s'"), buf.buf);
+ } else
+ opts->allow_rerere_autoupdate = -1;
+
strbuf_release(&buf);
return 0;
add_var(&script_snippet, "switch_to", opts->switch_to);
add_var(&script_snippet, "action", opts->action ? opts->action : "");
add_var(&script_snippet, "signoff", opts->signoff ? "--signoff" : "");
+ add_var(&script_snippet, "allow_rerere_autoupdate",
+ opts->allow_rerere_autoupdate < 0 ? "" :
+ opts->allow_rerere_autoupdate ?
+ "--rerere-autoupdate" : "--no-rerere-autoupdate");
switch (opts->type) {
case REBASE_AM:
.type = REBASE_UNSPECIFIED,
.flags = REBASE_NO_QUIET,
.git_am_opt = STRBUF_INIT,
+ .allow_rerere_autoupdate = -1,
};
const char *branch_name;
int ret, flags, total_argc, in_progress = 0;
ACTION_EDIT_TODO,
ACTION_SHOW_CURRENT_PATCH,
} action = NO_ACTION;
+ int committer_date_is_author_date = 0;
struct option builtin_rebase_options[] = {
OPT_STRING(0, "onto", &options.onto_name,
N_("revision"),
PARSE_OPT_NOARG, NULL, REBASE_DIFFSTAT },
OPT_BOOL(0, "signoff", &options.signoff,
N_("add a Signed-off-by: line to each commit")),
+ OPT_BOOL(0, "committer-date-is-author-date",
+ &committer_date_is_author_date,
+ N_("passed to 'git am'")),
OPT_BIT('f', "force-rebase", &options.flags,
N_("cherry-pick all commits, even if unchanged"),
REBASE_FORCE),
OPT_SET_INT('p', "preserve-merges", &options.type,
N_("try to recreate merges instead of ignoring "
"them"), REBASE_PRESERVE_MERGES),
+ OPT_BOOL(0, "rerere-autoupdate",
+ &options.allow_rerere_autoupdate,
+ N_("allow rerere to update index with resolved "
+ "conflict")),
OPT_END(),
};
if (!(options.flags & REBASE_NO_QUIET))
strbuf_addstr(&options.git_am_opt, " -q");
+ if (committer_date_is_author_date) {
+ strbuf_addstr(&options.git_am_opt,
+ " --committer-date-is-author-date");
+ options.flags |= REBASE_FORCE;
+ }
+
switch (options.type) {
case REBASE_MERGE:
case REBASE_INTERACTIVE: