public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Ramsay Jones <ramsay@ramsay1•demon.co.uk>,
	Jens.Lehmann@web•de, GIT Mailing-list <git@vger•kernel.org>
Subject: Re: [PATCH] t7507-*.sh: Fix test #8 (could not run '"$FAKE_EDITOR"')
Date: Wed, 20 Nov 2013 10:33:28 -0800	[thread overview]
Message-ID: <xmqqhab67wjr.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20131120174226.GA16453@sigill.intra.peff.net> (Jeff King's message of "Wed, 20 Nov 2013 12:42:27 -0500")

Jeff King <peff@peff•net> writes:

> The test_set_editor helper does some magic to help with quoting, but
> that should not be an issue in this case (since we are using "cat"). We
> are using test_set_editor elsewhere in the script, which would have set
> EDITOR previously. But I would think that GIT_EDITOR, which we are using
> here, would supersede that. However, the error message he shows
> indicates that git is using EDITOR (as FAKE_EDITOR is part of that quote
> magic).
>
> Am I misremembering the issues with one-shot variables and functions?

I think there are two problems involved.

The first is that we are not really using GIT_EDITOR under some
shells; to wit:

------------------------ >8 ------------------------

$ cat >/var/tmp/dashtest.sh <<\EOF
#!/bin/sh

test_must_fail () {
	(
		env | sed -n -e '/EDITOR/s/^/>> /p'
	)
}

EDITOR=dog
export EDITOR

GIT_EDITOR=cat test_must_fail foo
EOF

$ dash /var/tmp/dashtest.sh
>> EDITOR=dog
$ bash /var/tmp/dashtest.sh
>> GIT_EDITOR=cat
>> EDITOR=dog

------------------------ 8< ------------------------

So it appears that GIT_EDITOR that was never exported in the script
fails to get exported with the "VAR=VAL cmd" syntax under dash, when
cmd is not a command but is a shell function.  The "git commit" in
question ends up using $EDITOR.

Another is that EDITOR="$FAKE_EDITOR" that is set up earlier in the
is having trouble launching (I have a feeling that it never was
actually used because everybody uses "commit -F <file>").

  reply	other threads:[~2013-11-20 18:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 16:45 [PATCH] t7507-*.sh: Fix test #8 (could not run '"$FAKE_EDITOR"') Ramsay Jones
2013-11-20 17:22 ` Junio C Hamano
2013-11-20 17:42   ` Jeff King
2013-11-20 18:33     ` Junio C Hamano [this message]
2013-11-20 18:54       ` Jeff King
2013-11-20 19:01         ` Jeff King
2013-11-20 19:35   ` Ramsay Jones
2013-11-20 21:32     ` Jens Lehmann

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqhab67wjr.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Jens.Lehmann@web$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    --cc=ramsay@ramsay1$(echo .)demon.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox