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>
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 600788b..36d311b 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";