summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2009-10-30 20:24:04 -0500
committerJunio C Hamano <gitster@pobox.com>2009-10-30 19:15:38 -0700
commiteab58f1e8e5ef86b5075ce6dfcd6d3f1b3b888b3 (patch)
tree6760ae17f8fce48ddf13e306c85d0dbcf87f9827
parentcd0f8e6d63d3e2744d7d3b2329238be7d064a8ea (diff)
downloadgit-eab58f1e8e5ef86b5075ce6dfcd6d3f1b3b888b3.tar.gz
Handle more shell metacharacters in editor names
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>
-rw-r--r--editor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/editor.c b/editor.c
index 4d469d076b..941c0b2ab6 100644
--- a/editor.c
+++ b/editor.c
@@ -28,7 +28,7 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
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";