git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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>").

Previous: Jeff KingNext: Jeff King
Message 4 of 8 in “t7507-*.sh: Fix test #8 (could not run '"$FAKE_EDITOR"')”
  1. t7507-*.sh: Fix test #8 (could not run '"$FAKE_EDITOR"')Ramsay Jones, Nov 20, 2013
  2. Junio C HamanoNov 20, 2013
  3. Jeff KingNov 20, 2013
  4. Junio C HamanoNov 20, 2013
  5. Jeff KingNov 20, 2013
  6. Jeff KingNov 20, 2013
  7. Ramsay JonesNov 20, 2013
  8. Jens LehmannNov 20, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.