summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-02-15 21:36:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-16 23:40:42 (GMT)
commit52eb738d6b40bf8816727fcf7f39febc761ef0db (patch)
tree78f8a2baf0660a987b2fdc93665def51f44e5432 /builtin
parent8af14f08596197d53c40b71ed014b030956a12be (diff)
downloadgit-52eb738d6b40bf8816727fcf7f39febc761ef0db.zip
git-52eb738d6b40bf8816727fcf7f39febc761ef0db.tar.gz
git-52eb738d6b40bf8816727fcf7f39febc761ef0db.tar.bz2
rebase: add an --am option
Currently, this option doesn't do anything except error out if any options requiring the interactive-backend are also passed. However, when we make the default backend configurable later in this series, this flag will provide a way to override the config setting. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rebase.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index a2f05f7..77abe67 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1335,6 +1335,18 @@ done:
return res && is_linear_history(onto, head);
}
+static int parse_opt_am(const struct option *opt, const char *arg, int unset)
+{
+ struct rebase_options *opts = opt->value;
+
+ BUG_ON_OPT_NEG(unset);
+ BUG_ON_OPT_ARG(arg);
+
+ opts->type = REBASE_AM;
+
+ return 0;
+}
+
/* -i followed by -m is still -i */
static int parse_opt_merge(const struct option *opt, const char *arg, int unset)
{
@@ -1519,6 +1531,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
OPT_CMDMODE(0, "show-current-patch", &action,
N_("show the patch file being applied or merged"),
ACTION_SHOW_CURRENT_PATCH),
+ { OPTION_CALLBACK, 0, "am", &options, NULL,
+ N_("use apply-mail strategies to rebase"),
+ PARSE_OPT_NOARG | PARSE_OPT_NONEG,
+ parse_opt_am },
{ OPTION_CALLBACK, 'm', "merge", &options, NULL,
N_("use merging strategies to rebase"),
PARSE_OPT_NOARG | PARSE_OPT_NONEG,
@@ -1878,7 +1894,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (isatty(2) && options.flags & REBASE_NO_QUIET)
strbuf_addstr(&options.git_format_patch_opt, " --progress");
- if (options.git_am_opts.argc) {
+ if (options.git_am_opts.argc || options.type == REBASE_AM) {
/* all am options except -q are compatible only with --am */
for (i = options.git_am_opts.argc - 1; i >= 0; i--)
if (strcmp(options.git_am_opts.argv[i], "-q"))