From 5e2de4f9bb666186e4f8ba0c9c5db640fd7a04bd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 22 Dec 2007 09:45:10 -0800 Subject: [PATCH] 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 --- builtin-tag.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/builtin-tag.c b/builtin-tag.c index 020ee1cb7..03e70155f 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -47,7 +47,19 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e editor = "vi"; if (strcmp(editor, ":")) { - const char *args[] = { editor, path, NULL }; + size_t len = strlen(editor); + int i = 0; + const char *args[6]; + + if (strcspn(editor, "$ \t'") != len) { + /* there are specials */ + args[i++] = "sh"; + args[i++] = "-c"; + args[i++] = "$0 \"$@\""; + } + args[i++] = editor; + args[i++] = path; + args[i] = NULL; if (run_command_v_opt_cd_env(args, 0, NULL, env)) die("There was a problem with the editor %s.", editor); -- 2.30.2