summaryrefslogtreecommitdiff
path: root/editor.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-01-17 15:58:15 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-01-17 15:58:15 -0800
commit4fa088209c81845e73756a4173a8c954e25958d2 (patch)
tree7590d45bb9b42df97f3bd2e8e833aa4561cf1028 /editor.c
parentMerge branch 'sr/gfi-options' (diff)
parentt4030, t4031: work around bogus MSYS bash path conversion (diff)
downloadtgif-4fa088209c81845e73756a4173a8c954e25958d2.tar.xz
Merge branch 'jk/run-command-use-shell'
* jk/run-command-use-shell: t4030, t4031: work around bogus MSYS bash path conversion diff: run external diff helper with shell textconv: use shell to run helper editor: use run_command's shell feature run-command: optimize out useless shell calls run-command: convert simple callsites to use_shell t0021: use $SHELL_PATH for the filter script run-command: add "use shell" option
Diffstat (limited to 'editor.c')
-rw-r--r--editor.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/editor.c b/editor.c
index 615f5754d6..d8340031d2 100644
--- a/editor.c
+++ b/editor.c
@@ -36,26 +36,9 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
return error("Terminal is dumb, but EDITOR unset");
if (strcmp(editor, ":")) {
- size_t len = strlen(editor);
- int i = 0;
- int failed;
- const char *args[6];
- struct strbuf arg0 = STRBUF_INIT;
+ const char *args[] = { editor, path, NULL };
- if (strcspn(editor, "|&;<>()$`\\\"' \t\n*?[#~=%") != len) {
- /* there are specials */
- strbuf_addf(&arg0, "%s \"$@\"", editor);
- args[i++] = "sh";
- args[i++] = "-c";
- args[i++] = arg0.buf;
- }
- args[i++] = editor;
- args[i++] = path;
- args[i] = NULL;
-
- failed = run_command_v_opt_cd_env(args, 0, NULL, env);
- strbuf_release(&arg0);
- if (failed)
+ if (run_command_v_opt_cd_env(args, RUN_USING_SHELL, NULL, env))
return error("There was a problem with the editor '%s'.",
editor);
}