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>

Pratik Karki committed Aug 8, 2018 at 21:21 UTC 3dba9d08842226483c2d146e6dd37a6bfd27914e
1 file changed +7
builtin/rebase.c
+7
@@ -383,6 +383,13 @@ static int run_specific_rebase(struct rebase_options *opts)
383 add_var(&script_snippet, "git_format_patch_opt",
384 opts->git_format_patch_opt.buf);
385
386 + if (is_interactive(opts) &&
387 + !(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
388 + strbuf_addstr(&script_snippet,
389 + "GIT_EDITOR=:; export GIT_EDITOR; ");
390 + opts->autosquash = 0;
391 + }
392 +
393 switch (opts->type) {
394 case REBASE_AM:
395 backend = "git-rebase--am";