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, 17:22 UTC
Message-ID
<xmqqsiur6l9k.fsf@gitster.dls.corp.google.com>
In-Reply-To
<528CE716.8060307@ramsay1.demon.co.uk>
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
Show 15 quoted lines
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>
> Hi Jens,
>
> commit 61b6a633 ("commit -v: strip diffs and submodule shortlogs
> from the commit message", 19-11-2013) in 'pu' fails the new test
> it added to t7507.
>
> I didn't spend too long looking at the problem, so take this patch
> as nothing more than a quick suggestion for a possible solution! :-P
> [The err file contained something like: "There was a problem with the
> editor '"$FAKE_EDITOR"'"].
>
> Having said that, this fixes it for me ...

Well spotted. test_must_fail being a shell function, not a command, we shouldn't have used the "VAR=val cmd" one-shot environment assignment for portability.

Even though this happens to be the last test in the script, using test_set_editor to permanently affect the choice of editor for tests that follow is not generally a good idea. It would be safer to do this, I would have to say:

		git commit -a -m "submodule commit"
	) &&
        (
		GIT_EDITOR=cat &&
                export GIT_EDITOR &&
                test_must_fail git commit -a -v 2>err
	) &&
        test_i18ngrep "Aborting ..."
Thanks.
Show 19 quoted lines
> ATB,
> Ramsay Jones
>
>  t/t7507-commit-verbose.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
> index 09c1150..49cfb3c 100755
> --- a/t/t7507-commit-verbose.sh
> +++ b/t/t7507-commit-verbose.sh
> @@ -79,7 +79,8 @@ test_expect_success 'submodule log is stripped out too with -v' '
>  		echo "more" >>file &&
>  		git commit -a -m "submodule commit"
>  	) &&
> -	GIT_EDITOR=cat test_must_fail git commit -a -v 2>err &&
> +	test_set_editor cat &&
> +	test_must_fail git commit -a -v 2>err &&
>  	test_i18ngrep "Aborting commit due to empty commit message." err
>  '
Previous: Ramsay JonesNext: Jeff King
Message 2 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.