From 3dba9d08842226483c2d146e6dd37a6bfd27914e Mon Sep 17 00:00:00 2001 From: Pratik Karki Date: Wed, 8 Aug 2018 21:21:34 +0545 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- builtin/rebase.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 600788bf72..36d311b42f 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -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"; -- 2.40.0