From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Schindelin Subject: [PATCH 2/3] launch_editor(): read the file, even when EDITOR=: Date: Thu, 8 Nov 2007 12:15:48 +0000 (GMT) Message-ID: References: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII To: git@vger.kernel.org, krh@redhat.com, gitster@pobox.com X-From: git-owner@vger.kernel.org Thu Nov 08 13:16:16 2007 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1Iq6Iu-0007sY-UP for gcvg-git-2@gmane.org; Thu, 08 Nov 2007 13:16:13 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758951AbXKHMPz (ORCPT ); Thu, 8 Nov 2007 07:15:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758931AbXKHMPz (ORCPT ); Thu, 8 Nov 2007 07:15:55 -0500 Received: from mail.gmx.net ([213.165.64.20]:43691 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757842AbXKHMPy (ORCPT ); Thu, 8 Nov 2007 07:15:54 -0500 Received: (qmail invoked by alias); 08 Nov 2007 12:15:53 -0000 Received: from unknown (EHLO openvpn-client) [138.251.11.103] by mail.gmx.net (mp012) with SMTP; 08 Nov 2007 13:15:53 +0100 X-Authenticated: #1490710 X-Provags-ID: V01U2FsdGVkX18pg+ga7JQp85EGoa3OvP18x9PbAEmDzCOImUUam0 tjhaciUueSc0C8 X-X-Sender: gene099@racer.site In-Reply-To: X-Y-GMX-Trusted: 0 Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: Earlier we just returned in case EDITOR=: but the message stored in the file was not read back. Fix this. Signed-off-by: Johannes Schindelin --- builtin-tag.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff --git a/builtin-tag.c b/builtin-tag.c index c3b76da..f5e0f8a 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -20,7 +20,6 @@ static char signingkey[1000]; void launch_editor(const char *path, struct strbuf *buffer) { const char *editor, *terminal; - struct child_process child; const char *args[3]; editor = getenv("GIT_EDITOR"); @@ -42,17 +41,17 @@ void launch_editor(const char *path, struct strbuf *buffer) if (!editor) editor = "vi"; - if (!strcmp(editor, ":")) - return; + if (strcmp(editor, ":")) { + struct child_process child; + memset(&child, 0, sizeof(child)); + child.argv = args; + args[0] = editor; + args[1] = path; + args[2] = NULL; - memset(&child, 0, sizeof(child)); - child.argv = args; - args[0] = editor; - args[1] = path; - args[2] = NULL; - - if (run_command(&child)) - die("There was a problem with the editor %s.", editor); + if (run_command(&child)) + die("There was a problem with the editor %s.", editor); + } if (strbuf_read_file(buffer, path, 0) < 0) die("could not read message file '%s': %s", -- 1.5.3.5.1634.g0fa78