Re: [PATCH] t7507-*.sh: Fix test #8 (could not run '"$FAKE_EDITOR"')
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 20, 2013, 18:33 UTC
- Message-ID
- <xmqqhab67wjr.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20131120174226.GA16453@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> 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>").