Quoting Michael Rappazzo <[email protected]>:

+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.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to