From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: rpjday@crashcourse.ca, git@vger.kernel.org
Subject: Re: couple questions about git "logical variables" and "git var"
Date: Fri, 6 Oct 2017 00:33:01 -0400 [thread overview]
Message-ID: <20171006043300.to2d2zv6ludbinrh@sigill.intra.peff.net> (raw)
In-Reply-To: <20171006023530.GA134987@aiede.mtv.corp.google.com>
On Thu, Oct 05, 2017 at 07:35:30PM -0700, Jonathan Nieder wrote:
> > It also only tells half the story. You have to know not just what's in
> > $GIT_EDITOR, but you have to know the right way to evaluate it. There's
> > a git_editor helper in git-sh-setup, but other scripting languages are
> > on their own.
>
> I am not sure I understand the complaint here. git-var(1) says:
>
> GIT_EDITOR
> Text editor for use by Git commands. The value is meant to be
> interpreted by the shell when it is used. Examples: [...]
>
> Are you saying that the output of the command should quote that
> manpage, so as to tell the rest of the story?
No, I just meant that after reading that manpage, I'm not sure I would
have picked up the subtlety that shell scripts need to call:
eval "$GIT_EDITOR" '"$@"'
and not:
"$GIT_EDITOR" "$@"
or:
$GIT_EDITOR "$@"
(And likewise, other languages need to make sure they run "sh -c ..."
and not a straight spawn/exec of the editor command).
If the command were instead:
git editor "$@"
that's harder to get wrong.
-Peff
prev parent reply other threads:[~2017-10-06 4:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-05 9:11 couple questions about git "logical variables" and "git var" rpjday
2017-10-05 9:56 ` Jeff King
2017-10-06 2:35 ` Jonathan Nieder
2017-10-06 4:33 ` Jeff King [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171006043300.to2d2zv6ludbinrh@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=rpjday@crashcourse.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).