Skip to content

Commit 3fed96e

Browse files
prertikgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d9589e9 commit 3fed96e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

builtin/rebase.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,13 @@ static int run_specific_rebase(struct rebase_options *opts)
383383
add_var(&script_snippet, "git_format_patch_opt",
384384
opts->git_format_patch_opt.buf);
385385

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+
386393
switch (opts->type) {
387394
case REBASE_AM:
388395
backend = "git-rebase--am";

0 commit comments

Comments
 (0)