]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-tag.c
GIT 1.5.4-rc2
[git.git] / builtin-tag.c
index 020ee1cb777d666fc2c70f87f01081355c061424..03e70155fc676a8dd38ca5cef800ed4a446e921a 100644 (file)
@@ -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);