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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 26, 2008, 00:00 UTC
Message-ID
<7v63wch9ia.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LNX.1.00.0802251600220.19024@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
Show 7 quoted lines
> @@ -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.
Show 8 quoted lines
> @@ -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.

Previous: Daniel BarkalowNext: Daniel Barkalow
Message 2 of 8 in “[RFC] Support TEST_GIT_PATH variable for the path for the git to test”
  1. Daniel BarkalowFeb 25, 2008
  2. Junio C HamanoFeb 26, 2008
  3. Daniel BarkalowFeb 26, 2008
  4. Junio C HamanoFeb 26, 2008
  5. Daniel BarkalowFeb 26, 2008
  6. Junio C HamanoFeb 26, 2008
  7. Daniel BarkalowFeb 26, 2008
  8. Junio C HamanoFeb 26, 2008

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.