Skip to content

Commit 5e2de4f

Browse files
committed
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>
1 parent 77190eb commit 5e2de4f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

builtin-tag.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,19 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e
4747
editor = "vi";
4848

4949
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;
5163

5264
if (run_command_v_opt_cd_env(args, 0, NULL, env))
5365
die("There was a problem with the editor %s.", editor);

0 commit comments

Comments
 (0)