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

Re: [PATCH] builtin-config: add --exec-editor for use in scripts

From
EWEric Wong <normalperson@yhbt.net>
Date
Feb 3, 2009, 04:55 UTC
Message-ID
<20090203045520.GB2483@dcvr.yhbt.net>
In-Reply-To
<m3pri1w484.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> wrote:
Show 26 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> > Eric Wong <normalperson@yhbt.net> writes:
> > 
> > > This exposes the launch_editor() library function for use by
> > > various scripting languages.  This allows the ensure consistent
> > > handling of GIT_EDITOR/VISUAL/EDITOR environment variables as
> > > well as the handling of special characters such as spaces in the
> > > various environment variables.
> > >
> > > Signed-off-by: Eric Wong <normalperson@yhbt.net>
> > > ---
> > >
> > >  I'm not sure if git-config is the best place to stick it.  I plan to
> > >  start using this in git-svn but I don't want to implement Git::Editor
> > >  in Perl and have to keep track of editor.c.  Of course this also makes
> > >  the logic/rules used in libgit usable to any other scripting language
> > >  capable of launching other programs.
> > 
> > I agree that git-config is probably a wrong place.  A separate command
> > "git editor" (or "git user-preference --editor", if you extend it to pager
> > and others) perhaps?
> > 
> > I also agree that something like this would make scripting Porcelains a
> > much pleasant experience.
> 
> I don't think this is something that should be put in 'git rev-parse',
                                   You meant 'git config' --/
				   Unless you remotely accessed my
				   brain while I was deciding on this
				   before I picked 'git config' :)
> but perhaps a bit obscure 'git var' (print a git logical variable)
> would be a good place for that?

Well, it would involve executing another program; so 'git var' might not be a good fit. I don't want it to just print out what command to run because of quoting rules (and my primary reason for wanting to standardize on this was because a user privately emailed me about wanting to use 'mate -w' as his GIT_EDITOR with git-svn).

Junio: "git user-preference" would be confusing given we
already have "git config"...
Perhaps a new command called 'git exec-helper' ?

git exec-helper pager git exec-helper editor <FILE> ... git exec-helper sendmail ? git exec-helper browser <URL> ?

-- 
Eric Wong
Previous: Jakub NarebskiNext: Junio C Hamano
Message 4 of 5 in “builtin-config: add --exec-editor for use in scripts”
  1. builtin-config: add --exec-editor for use in scriptsEric Wong, Feb 1, 2009
  2. Junio C HamanoFeb 2, 2009
  3. Jakub NarebskiFeb 2, 2009
  4. Eric WongFeb 3, 2009
  5. Junio C HamanoFeb 3, 2009

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.