Subject: Re: [PATCH RFC v6 01/19] Makefile: use common template for GIT-BUILD-OPTIONS

From: Junio C Hamano <[email-masked]>
Date: Wed, 13 Nov 2024 16:13:11 +0900

Patrick Steinhardt <[email-masked]> writes:

> Note that this change requires us to move around the setup of
> TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing
> the "GIT-BUILD-OPTIONS" file. This is the only instance I could find
> where we rely on ordering on variables.

Doesn't this change break those who use the TEST_OUTPUT_DIRECTORY
environment variable as a mechanism to override where the ouput is
sent?  E.g.,

    $ cd t && TEST_OUTPUT_DIRECTORY=/else/where sh t1000-read-tree-m-3way.sh

They do not necessarily want their output directory affected by the
value that was in TEST_OUTPUT_DIRECTORY when $(MAKE) was run the
last time.

...
> -if test -z "$TEST_OUTPUT_DIRECTORY"
> -then
> -	# Similarly, override this to store the test-results subdir
> -	# elsewhere
> -	TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
> -fi
>  GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
>  if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
>  then
> @@ -100,6 +94,13 @@ fi
>  . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
>  export PERL_PATH SHELL_PATH
>  
> +if test -z "$TEST_OUTPUT_DIRECTORY"
> +then
> +	# Similarly, override this to store the test-results subdir
> +	# elsewhere
> +	TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
> +fi