Junio C Hamano <gitster@xxxxxxxxx> writes: > Junio C Hamano <gitster@xxxxxxxxx> writes: > >> The relevant part of git-p4 is this: >> >> # invoke the editor >> if os.environ.has_key("P4EDITOR") and (os.environ.get("P4EDITOR") != ""): >> editor = os.environ.get("P4EDITOR") >> else: >> editor = read_pipe("git var GIT_EDITOR").strip() >> system([editor, template_file]) >> >> It grabs $EDITOR (or $GIT_EDITOR) and treats it as the path to the >> editor executable, without letting shell to split that into words at >> whitespace boundaries, so that you can say things like >> >> EDITOR="/User/me/My Programs/nano" >> >> The way we spawn EDITOR in our core codepaths matches what git-p4 >> does, too: >> >> const char *args[] = { editor, real_path(path), NULL }; >> struct child_process p = CHILD_PROCESS_INIT; >> int ret, sig; >> >> p.argv = args; >> p.env = env; >> p.use_shell = 1; >> if (start_command(&p) < 0) >> return error("unable to start editor '%s'", editor); >> ... >> >> So... > > Well, I'll take that back. I misread p.use_shell line. So, use_shell==true codepath grabs that array with "editor", "path" and turns it into an equivalent to sh -c "$EDITOR" "$path" when $EDITOR has a "magic" character (including whitespace) in it. So what git-p4 does is *not* in line with how we use the environment variable. Perhaps a single-liner patch like this would work? - system([editor, template_file]) + system(["sh", "-c", editor, template_file]) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html