From: Junio C Hamano Date: Fri, 2 Nov 2018 02:04:57 +0000 (+0900) Subject: Merge branch 'jc/rebase-in-c-5-test-typofix' X-Git-Tag: v2.20.0-rc0~87 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7ce32f72e3eb0d82ead82d748f10cbd0d0c4066c?hp=-c Merge branch 'jc/rebase-in-c-5-test-typofix' Typofix. * jc/rebase-in-c-5-test-typofix: rebase: fix typoes in error messages --- 7ce32f72e3eb0d82ead82d748f10cbd0d0c4066c diff --combined builtin/rebase.c index f1355efee7,5242e01ad0..313a8263df --- a/builtin/rebase.c +++ b/builtin/rebase.c @@@ -21,7 -21,6 +21,7 @@@ #include "diff.h" #include "wt-status.h" #include "revision.h" +#include "commit-reach.h" #include "rerere.h" static char const * const builtin_rebase_usage[] = { @@@ -55,7 -54,7 +55,7 @@@ static int use_builtin_rebase(void cp.git_cmd = 1; if (capture_command(&cp, &out, 6)) { strbuf_release(&out); - return 0; + return 1; } strbuf_trim(&out); @@@ -327,13 -326,6 +327,13 @@@ static void add_var(struct strbuf *buf } } +static const char *resolvemsg = +N_("Resolve all conflicts manually, mark them as resolved with\n" +"\"git add/rm \", then run \"git rebase --continue\".\n" +"You can instead skip this commit: run \"git rebase --skip\".\n" +"To abort and get back to the state before \"git rebase\", run " +"\"git rebase --abort\"."); + static int run_specific_rebase(struct rebase_options *opts) { const char *argv[] = { NULL, NULL }; @@@ -341,79 -333,6 +341,79 @@@ int status; const char *backend, *backend_func; + if (opts->type == REBASE_INTERACTIVE) { + /* Run builtin interactive rebase */ + struct child_process child = CHILD_PROCESS_INIT; + + argv_array_pushf(&child.env_array, "GIT_CHERRY_PICK_HELP=%s", + resolvemsg); + if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) { + argv_array_push(&child.env_array, "GIT_EDITOR=:"); + opts->autosquash = 0; + } + + child.git_cmd = 1; + argv_array_push(&child.args, "rebase--interactive"); + + if (opts->action) + argv_array_pushf(&child.args, "--%s", opts->action); + if (opts->keep_empty) + argv_array_push(&child.args, "--keep-empty"); + if (opts->rebase_merges) + argv_array_push(&child.args, "--rebase-merges"); + if (opts->rebase_cousins) + argv_array_push(&child.args, "--rebase-cousins"); + if (opts->autosquash) + argv_array_push(&child.args, "--autosquash"); + if (opts->flags & REBASE_VERBOSE) + argv_array_push(&child.args, "--verbose"); + if (opts->flags & REBASE_FORCE) + argv_array_push(&child.args, "--no-ff"); + if (opts->restrict_revision) + argv_array_pushf(&child.args, + "--restrict-revision=^%s", + oid_to_hex(&opts->restrict_revision->object.oid)); + if (opts->upstream) + argv_array_pushf(&child.args, "--upstream=%s", + oid_to_hex(&opts->upstream->object.oid)); + if (opts->onto) + argv_array_pushf(&child.args, "--onto=%s", + oid_to_hex(&opts->onto->object.oid)); + if (opts->squash_onto) + argv_array_pushf(&child.args, "--squash-onto=%s", + oid_to_hex(opts->squash_onto)); + if (opts->onto_name) + argv_array_pushf(&child.args, "--onto-name=%s", + opts->onto_name); + argv_array_pushf(&child.args, "--head-name=%s", + opts->head_name ? + opts->head_name : "detached HEAD"); + if (opts->strategy) + argv_array_pushf(&child.args, "--strategy=%s", + opts->strategy); + if (opts->strategy_opts) + argv_array_pushf(&child.args, "--strategy-opts=%s", + opts->strategy_opts); + if (opts->switch_to) + argv_array_pushf(&child.args, "--switch-to=%s", + opts->switch_to); + if (opts->cmd) + argv_array_pushf(&child.args, "--cmd=%s", opts->cmd); + if (opts->allow_empty_message) + argv_array_push(&child.args, "--allow-empty-message"); + if (opts->allow_rerere_autoupdate > 0) + argv_array_push(&child.args, "--rerere-autoupdate"); + else if (opts->allow_rerere_autoupdate == 0) + argv_array_push(&child.args, "--no-rerere-autoupdate"); + if (opts->gpg_sign_opt) + argv_array_push(&child.args, opts->gpg_sign_opt); + if (opts->signoff) + argv_array_push(&child.args, "--signoff"); + + status = run_command(&child); + goto finished_rebase; + } + add_var(&script_snippet, "GIT_DIR", absolute_path(get_git_dir())); add_var(&script_snippet, "state_dir", opts->state_dir); @@@ -476,6 -395,10 +476,6 @@@ backend = "git-rebase--am"; backend_func = "git_rebase__am"; break; - case REBASE_INTERACTIVE: - backend = "git-rebase--interactive"; - backend_func = "git_rebase__interactive"; - break; case REBASE_MERGE: backend = "git-rebase--merge"; backend_func = "git_rebase__merge"; @@@ -495,11 -418,8 +495,11 @@@ argv[0] = script_snippet.buf; status = run_command_v_opt(argv, RUN_USING_SHELL); +finished_rebase: if (opts->dont_finish_rebase) ; /* do nothing */ + else if (opts->type == REBASE_INTERACTIVE) + ; /* interactive rebase cleans up after itself */ else if (status == 0) { if (!file_exists(state_dir_path("stopped-sha", opts))) finish_rebase(opts); @@@ -1216,15 -1136,15 +1216,15 @@@ int cmd_rebase(int argc, const char **a * git-rebase.txt caveats with "unless you know what you are doing" */ if (options.rebase_merges) - die(_("error: cannot combine '--preserve_merges' with " + die(_("error: cannot combine '--preserve-merges' with " "'--rebase-merges'")); if (options.rebase_merges) { if (strategy_options.nr) - die(_("error: cannot combine '--rebase_merges' with " + die(_("error: cannot combine '--rebase-merges' with " "'--strategy-option'")); if (options.strategy) - die(_("error: cannot combine '--rebase_merges' with " + die(_("error: cannot combine '--rebase-merges' with " "'--strategy'")); }