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

Re: [PATCH v2 2/2] t1500-rev-parse: rewrite each test to run in isolation

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Apr 17, 2016, 09:42 UTC
Message-ID
<20160417114253.Horde.giIo57RkUzhAe6GP-RahIrw@webmail.informatik.kit.edu>
In-Reply-To
<1460823230-45692-3-git-send-email-rappazzo@gmail.com>
Quoting Michael Rappazzo <rappazzo@gmail.com>:
Show 8 quoted lines
> +test_expect_success 'GIT_DIR=../.git, core.bare = false:  
> is-bare-repository' '
> +	mkdir work &&
> +	test_when_finished "rm -rf work" &&
> +	test_config -C "$(pwd)"/.git core.bare false &&
> +	GIT_DIR=../.git test_stdout false git -C work rev-parse  
> --is-bare-repository
> +'

Here and in the following tests as well: some shells don't cope that well with a one-shot environmental variable set in front of a shell function. See commit 512477b17528:

     tests: use "env" to run commands with temporary env-var settings
     Ordinarily, we would say "VAR=VAL command" to execute a tested
     command with environment variable(s) set only for that command.
     This however does not work if 'command' is a shell function (most
     notably 'test_must_fail'); the result of the assignment is retained
     and affects later commands.
     To avoid this, we used to assign and export environment variables
     and run such a test in a subshell, like so:
             (
                     VAR=VAL && export VAR &&
                     test_must_fail git command to be tested
             )
     But with "env" utility, we should be able to say:
             test_must_fail env VAR=VAL git command to be tested
     which is much shorter and easier to read.
Previous: Johannes SixtNext: Eric Sunshine
Message 12 of 13 in “t1500-rev-parse: re-write t1500”
  1. 0/2 t1500-rev-parse: re-write t1500Michael Rappazzo, Apr 16, 2016
  2. 1/2 test-lib: add a function to compare an expection with stdout from a commandMichael Rappazzo, Apr 16, 2016
  3. Eric SunshineApr 17, 2016
  4. Jeff KingApr 17, 2016
  5. Eric SunshineApr 17, 2016
  6. Jeff KingApr 17, 2016
  7. Johannes SixtApr 17, 2016
  8. Eric SunshineApr 17, 2016
  9. 2/2 t1500-rev-parse: rewrite each test to run in isolationMichael Rappazzo, Apr 16, 2016
  10. Eric SunshineApr 17, 2016
  11. Johannes SixtApr 17, 2016
  12. SZEDER GáborApr 17, 2016
  13. Eric SunshineApr 17, 2016

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.