Revert "editor: save and reset terminal after calling EDITOR"

This reverts commit 3d411afabc9a96f41d47c07d6af6edda3d29ec92, blindly opening /dev/tty and calling tcsetattr() seems to be causing problems. cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=577358 cf. https://lore.kernel.org/git/04ab7301-ea34-476c-eae4-4044fef74b91@gmail.com/ Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 22, 2021 at 15:04 UTC e3f7e01b50be94bfe6cf35b2f1e01ab75804d8d8
1 file changed -8
editor.c
-8
@@ -3,7 +3,6 @@
3 #include "strbuf.h"
4 #include "run-command.h"
5 #include "sigchain.h"
6 -#include "compat/terminal.h"
6
7 #ifndef DEFAULT_EDITOR
8 #define DEFAULT_EDITOR "vi"
@@ -51,8 +50,6 @@ const char *git_sequence_editor(void)
50 static int launch_specified_editor(const char *editor, const char *path,
51 struct strbuf *buffer, const char *const *env)
52 {
54 - int term_fail;
55 -
53 if (!editor)
54 return error("Terminal is dumb, but EDITOR unset");
55
@@ -86,10 +83,7 @@ static int launch_specified_editor(const char *editor, const char *path,
83 p.env = env;
84 p.use_shell = 1;
85 p.trace2_child_class = "editor";
89 - term_fail = save_term(1);
86 if (start_command(&p) < 0) {
91 - if (!term_fail)
92 - restore_term();
87 strbuf_release(&realpath);
88 return error("unable to start editor '%s'", editor);
89 }
@@ -97,8 +91,6 @@ static int launch_specified_editor(const char *editor, const char *path,
91 sigchain_push(SIGINT, SIG_IGN);
92 sigchain_push(SIGQUIT, SIG_IGN);
93 ret = finish_command(&p);
100 - if (!term_fail)
101 - restore_term();
94 strbuf_release(&realpath);
95 sig = ret - 128;
96 sigchain_pop(SIGINT);