@matheusbsbs / matheus-bagliano / commits / 5e2de4f9bb
Fork 0

Fix $EDITOR regression introduced by rewrite in C.

When git-tag and git-commit launches the editor, they used to honor EDITOR="editor -options args..." but recent rewrite in C insisted on $EDITOR to be the path to the editor executable. This restores the older behaviour. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Dec 22, 2007 at 09:45 UTC 5e2de4f9bb666186e4f8ba0c9c5db640fd7a04bd
1 file changed +13 -1
builtin-tag.c
+13 -1
@@ -47,7 +47,19 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e
47 editor = "vi";
48
49 if (strcmp(editor, ":")) {
50 - const char *args[] = { editor, path, NULL };
50 + size_t len = strlen(editor);
51 + int i = 0;
52 + const char *args[6];
53 +
54 + if (strcspn(editor, "$ \t'") != len) {
55 + /* there are specials */
56 + args[i++] = "sh";
57 + args[i++] = "-c";
58 + args[i++] = "$0 \"$@\"";
59 + }
60 + args[i++] = editor;
61 + args[i++] = path;
62 + args[i] = NULL;
63
64 if (run_command_v_opt_cd_env(args, 0, NULL, env))
65 die("There was a problem with the editor %s.", editor);