diff options
author | 2019-02-06 22:05:20 -0800 | |
---|---|---|
committer | 2019-02-06 22:05:20 -0800 | |
commit | 8fe9c3f21dff206acb464d86cbd3bf4dbbb94f38 (patch) | |
tree | f33b9ec70cc3d7e7a068d7ef24a6895d69accf00 /builtin | |
parent | Fifth batch for 2.21 (diff) | |
parent | rebase: implement --merge via the interactive machinery (diff) | |
download | tgif-8fe9c3f21dff206acb464d86cbd3bf4dbbb94f38.tar.xz |
Merge branch 'en/rebase-merge-on-sequencer'
"git rebase --merge" as been reimplemented by reusing the internal
machinery used for "git rebase -i".
* en/rebase-merge-on-sequencer:
rebase: implement --merge via the interactive machinery
rebase: define linearization ordering and enforce it
git-legacy-rebase: simplify unnecessary triply-nested if
git-rebase, sequencer: extend --quiet option for the interactive machinery
am, rebase--merge: do not overlook --skip'ed commits with post-rewrite
t5407: add a test demonstrating how interactive handles --skip differently
rebase: fix incompatible options error message
rebase: make builtin and legacy script error messages the same
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/am.c | 9 | ||||
-rw-r--r-- | builtin/rebase.c | 30 |
2 files changed, 19 insertions, 20 deletions
diff --git a/builtin/am.c b/builtin/am.c index 95370313b6..6d1c6d3da9 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2000,6 +2000,15 @@ static void am_skip(struct am_state *state) if (clean_index(&head, &head)) die(_("failed to clean index")); + if (state->rebasing) { + FILE *fp = xfopen(am_path(state, "rewritten"), "a"); + + assert(!is_null_oid(&state->orig_commit)); + fprintf(fp, "%s ", oid_to_hex(&state->orig_commit)); + fprintf(fp, "%s\n", oid_to_hex(&head)); + fclose(fp); + } + am_next(state); am_load(state); am_run(state, 0); diff --git a/builtin/rebase.c b/builtin/rebase.c index fdeb41e899..3f9b26f729 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -123,7 +123,7 @@ static void imply_interactive(struct rebase_options *opts, const char *option) case REBASE_PRESERVE_MERGES: break; case REBASE_MERGE: - /* we silently *upgrade* --merge to --interactive if needed */ + /* we now implement --merge via --interactive */ default: opts->type = REBASE_INTERACTIVE; /* implied */ break; @@ -186,10 +186,7 @@ static int read_basic_state(struct rebase_options *opts) if (get_oid(buf.buf, &opts->orig_head)) return error(_("invalid orig-head: '%s'"), buf.buf); - strbuf_reset(&buf); - if (read_one(state_dir_path("quiet", opts), &buf)) - return -1; - if (buf.len) + if (file_exists(state_dir_path("quiet", opts))) opts->flags &= ~REBASE_NO_QUIET; else opts->flags |= REBASE_NO_QUIET; @@ -488,10 +485,6 @@ static int run_specific_rebase(struct rebase_options *opts) backend = "git-rebase--am"; backend_func = "git_rebase__am"; break; - case REBASE_MERGE: - backend = "git-rebase--merge"; - backend_func = "git_rebase__merge"; - break; case REBASE_PRESERVE_MERGES: backend = "git-rebase--preserve-merges"; backend_func = "git_rebase__preserve_merges"; @@ -1233,6 +1226,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) } } + if (options.type == REBASE_MERGE) + imply_interactive(&options, "--merge"); + if (options.root && !options.onto_name) imply_interactive(&options, "--root without --onto"); @@ -1265,14 +1261,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) break; if (is_interactive(&options) && i >= 0) - die(_("error: cannot combine interactive options " - "(--interactive, --exec, --rebase-merges, " - "--preserve-merges, --keep-empty, --root + " - "--onto) with am options (%s)"), buf.buf); - if (options.type == REBASE_MERGE && i >= 0) - die(_("error: cannot combine merge options (--merge, " - "--strategy, --strategy-option) with am options " - "(%s)"), buf.buf); + die(_("cannot combine am options with either " + "interactive or merge options")); } if (options.signoff) { @@ -1290,7 +1280,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) * git-rebase.txt caveats with "unless you know what you are doing" */ if (options.rebase_merges) - die(_("error: cannot combine '--preserve-merges' with " + die(_("cannot combine '--preserve-merges' with " "'--rebase-merges'")); if (options.reschedule_failed_exec) @@ -1300,10 +1290,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (options.rebase_merges) { if (strategy_options.nr) - die(_("error: cannot combine '--rebase-merges' with " + die(_("cannot combine '--rebase-merges' with " "'--strategy-option'")); if (options.strategy) - die(_("error: cannot combine '--rebase-merges' with " + die(_("cannot combine '--rebase-merges' with " "'--strategy'")); } |