builtin rebase: use no-op editor when interactive is "implied"

Some options are only handled by the git-rebase--interactive backend,
even if run non-interactively. For this awkward situation (run
non-interactively, but use the interactive backend), the shell scripted
version of `git rebase` introduced the concept of an "implied
interactive rebase". All it does is to replace the editor by a dummy one
(`:` is the Unix command that takes arbitrary command-line parameters,
ignores them and simply exits with success).

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Pratik Karki
2018-08-08 21:21:34 +05:45
committed by Junio C Hamano
parent cda614e489
commit 3dba9d0884

View File

@ -383,6 +383,13 @@ static int run_specific_rebase(struct rebase_options *opts)
add_var(&script_snippet, "git_format_patch_opt",
opts->git_format_patch_opt.buf);
if (is_interactive(opts) &&
!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
strbuf_addstr(&script_snippet,
"GIT_EDITOR=:; export GIT_EDITOR; ");
opts->autosquash = 0;
}
switch (opts->type) {
case REBASE_AM:
backend = "git-rebase--am";