git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: git-p4 edit_template() and P4EDITOR w/options

From
Junio C Hamano <gitster@pobox.com>
Date
May 4, 2015, 22:01 UTC
Message-ID
<xmqqh9rsovd4.fsf@gitster.dls.corp.google.com>
In-Reply-To
<5D2E2EAF-FFE7-437F-A716-E152E865E634@pixar.com>
Chris Lasell <chrisl@pixar.com> writes:
Show 12 quoted lines
> PS: 'mate' is the CLI invocation of the TextMate GUI editor for OS
> X. The -w is required in this instance, or the 'mate' command
> would return instantly when the document opens. The -w causes it
> to wait until the document window is closed.
>
> I have noticed that the help output for mate says:
> =======
> By default mate will wait for files to be closed if the command name
> has a "_wait" suffix (e.g. via a symbolic link)
> =======
>
> and I have instructed my user to do just that for now.

I think that is not merely "for now" but is the way the command and the environment variable are designed to be used. A quick websearch for [$EDITOR environment with parameter] found this one

  http://superuser.com/questions/521070/unix-environment-variables-with-arguments
which seems to be talking about a similar issue (unrelated to Git).
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...
Previous: Chris LasellNext: Junio C Hamano
Message 2 of 8 in “Bug: git-p4 edit_template() and P4EDITOR w/options”
  1. Chris LasellMay 4, 2015
  2. Junio C HamanoMay 4, 2015
  3. Junio C HamanoMay 4, 2015
  4. Junio C HamanoMay 4, 2015
  5. Junio C HamanoMay 4, 2015
  6. Jonathan NiederMay 4, 2015
  7. Junio C HamanoMay 5, 2015
  8. Chris LasellMay 4, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.