git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH] send-email: lazily assign editor variable
Date: Mon, 22 Mar 2010 17:12:53 +0100	[thread overview]
Message-ID: <eb0d92cf28820eb9783e789a8c4c62c3af4dd0d0.1269274203.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <20100322145947.GA1709@pengutronix.de>

b4479f0 (add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR",
2009-10-30) introduced the use of git var GIT_EDITOR which may lead to
problems when send-mail is used without a tty.

Therefore, use git var GIT_EDITOR only when we actually edit something.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 git-send-email.perl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index d612ae8..bb09c0d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -162,9 +162,12 @@ my $compose_filename;
 
 # Handle interactive edition of files.
 my $multiedit;
-my $editor = Git::command_oneline('var', 'GIT_EDITOR');
+my $editor;
 
 sub do_edit {
+	if (!defined($editor)) {
+		$editor = Git::command_oneline('var', 'GIT_EDITOR');
+	}
 	if (defined($multiedit) && !$multiedit) {
 		map {
 			system('sh', '-c', $editor.' "$@"', $editor, $_);
-- 
1.7.0.3.435.g097f4

  reply	other threads:[~2010-03-22 16:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 14:59 [REGRESSION] git var GIT_EDITOR fails without tty Uwe Kleine-König
2010-03-22 16:12 ` Michael J Gruber [this message]
2010-03-22 16:41   ` [PATCH] send-email: lazily assign editor variable Uwe Kleine-König
2010-03-23  0:58   ` Jonathan Nieder
2010-03-23 10:56     ` Michael J Gruber
2010-03-24 17:52   ` Junio C Hamano
2010-03-25  5:17     ` Jonathan Nieder
2010-03-26 19:32       ` Junio C Hamano
2010-03-26 21:45         ` Jonathan Nieder
2010-03-25  8:03     ` Michael J Gruber
2010-03-26 19:32       ` Junio C Hamano
2010-03-22 23:25 ` [PATCH] send-email: do not check for editor until needed Jonathan Nieder
2010-03-23  9:15   ` Peter Kjellerstedt
2010-03-23 19:25     ` Jonathan Nieder

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=eb0d92cf28820eb9783e789a8c4c62c3af4dd0d0.1269274203.git.git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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).