X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-tag.c;h=8dd959fe1c74507023f8e82c7f4682c1588ebac6;hb=995e8df4a9de9cf7c1b98dac922d96dc6606946d;hp=28c36fdcd1658968ff7c3e2f1d6ba6f364f99592;hpb=f830d45b9fdb04a5d79c25bb3a3d891d8d3b58e9;p=git.git diff --git a/builtin-tag.c b/builtin-tag.c index 28c36fdcd..8dd959fe1 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -50,12 +50,15 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e size_t len = strlen(editor); int i = 0; const char *args[6]; + struct strbuf arg0; + strbuf_init(&arg0, 0); if (strcspn(editor, "$ \t'") != len) { /* there are specials */ + strbuf_addf(&arg0, "%s \"$@\"", editor); args[i++] = "sh"; args[i++] = "-c"; - args[i++] = "$0 \"$@\""; + args[i++] = arg0.buf; } args[i++] = editor; args[i++] = path; @@ -63,6 +66,7 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e if (run_command_v_opt_cd_env(args, 0, NULL, env)) die("There was a problem with the editor %s.", editor); + strbuf_release(&arg0); } if (!buffer)