launch_editor(): read the file, even when EDITOR=:
Earlier we just returned in case EDITOR=: but the message stored in the file was not read back. Fix this, at the same time simplifying the code as suggested by Johannes Sixt. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Nov 8, 2007 at 14:06 UTC
e97c9ad96b60d51b0b3852aaaff146015d01cb62
1 file changed
+5
-12
builtin-tag.c
+5
-12
@@ -20,8 +20,6 @@ static char signingkey[1000];
20
void launch_editor(const char *path, struct strbuf *buffer)
21
{
22
const char *editor, *terminal;
23
- struct child_process child;
24
- const char *args[3];
23
24
editor = getenv("GIT_EDITOR");
25
if (!editor && editor_program)
@@ -42,17 +40,12 @@ void launch_editor(const char *path, struct strbuf *buffer)
40
if (!editor)
41
editor = "vi";
42
45
- if (!strcmp(editor, ":"))
46
- return;
47
-
48
- memset(&child, 0, sizeof(child));
49
- child.argv = args;
50
- args[0] = editor;
51
- args[1] = path;
52
- args[2] = NULL;
43
+ if (strcmp(editor, ":")) {
44
+ const char *args[] = { editor, path, NULL };
45
54
- if (run_command(&child))
55
- die("There was a problem with the editor %s.", editor);
46
+ if (run_command_v_opt(args, 0))
47
+ die("There was a problem with the editor %s.", editor);
48
+ }
49
50
if (strbuf_read_file(buffer, path, 0) < 0)
51
die("could not read message file '%s': %s",