Re: [RFC] Support TEST_GIT_PATH variable for the path for the git to test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Barkalow <barkalow@xxxxxxxxxxxx> writes:

> @@ -281,7 +281,8 @@ test_create_repo () {
>  	cd "$repo" || error "Cannot setup test environment"
>  	"$GIT_EXEC_PATH/git" init --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
>  	error "cannot run git init -- have you built things yet?"
> -	mv .git/hooks .git/hooks-disabled
> +	[ ! -e .git/hooks ] || mv .git/hooks .git/hooks-disabled
> +	[ -e .git/info ] || mkdir .git/info

This is just a style issue, but if you try to be old fashioned,
please say "test frotz || xyzzy".  If you prefer to be modern,
"if ! test frotz; then xyzzy; fi".  I'd prefer the former, but
in either case I really do not want to see [ ... ] that do not
make anything more readable.

Also we tend to avoid "test -e" unless absolutely needed.

> @@ -321,8 +322,8 @@ test_done () {
>  
>  # Test the binaries we have just built.  The tests are kept in
>  # t/ subdirectory and are run in trash subdirectory.
> -PATH=$(pwd)/..:$PATH
> -GIT_EXEC_PATH=$(pwd)/..
> +GIT_EXEC_PATH=${TEST_GIT_PATH:-$(pwd)/..}
> +PATH=$GIT_EXEC_PATH:$(pwd)/..:$PATH

Hmmmm.

I have bunch of gits installed under $HOME/git-vX.Y.Z/bin and
when I need to test one from a different vintage, I just say:

	PATH=$HOME/git-vX.Y.Z/bin:/usr/bin:/bin
	... do git stuff which all use version X.Y.Z

and have $HOME/git-vX.Y.Z/bin/git find its corresponding friends
on the GIT_EXEC_PATH embedded in it.  Because you are interested
in testing installed versions, I suspect something like:

	if test -z "$TEST_GIT_ON_PATH"
	then
                GIT_EXEC_PATH=$(pwd)/..
        	PATH=$GIT_EXEC_PATH:$PATH
	else
        	: We do not do any customization
	fi

would be easier to read and more to the point.  Perhaps the
tester even has his own GIT_EXEC_PATH that is unrelated to
TEST_GIT_PATH.

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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux