summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cd0f8e6)
raw | patch | inline | side by side (parent: cd0f8e6)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Sat, 31 Oct 2009 01:24:04 +0000 (20:24 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 31 Oct 2009 02:15:38 +0000 (19:15 -0700) |
Pass the editor name to the shell if it contains any susv3 shell
special character (globs, redirections, variable substitutions,
escapes, etc). This way, the meaning of some characters will not
meaninglessly change when others are added, and git commands
implemented in C and in shell scripts will interpret editor names
in the same way.
This does not make the GIT_EDITOR setting any more expressive,
since one could always use single quotes to force the editor to
be passed to the shell.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
special character (globs, redirections, variable substitutions,
escapes, etc). This way, the meaning of some characters will not
meaninglessly change when others are added, and git commands
implemented in C and in shell scripts will interpret editor names
in the same way.
This does not make the GIT_EDITOR setting any more expressive,
since one could always use single quotes to force the editor to
be passed to the shell.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
editor.c | patch | blob | history |
diff --git a/editor.c b/editor.c
index 4d469d076bcd58df3af16d98adc9120e34765944..941c0b2ab6deeaaaa346256b7c8080fd67c996b2 100644 (file)
--- a/editor.c
+++ b/editor.c
const char *args[6];
struct strbuf arg0 = STRBUF_INIT;
- if (strcspn(editor, "$ \t'") != len) {
+ if (strcspn(editor, "|&;<>()$`\\\"' \t\n*?[#~=%") != len) {
/* there are specials */
strbuf_addf(&arg0, "%s \"$@\"", editor);
args[i++] = "sh";