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/infoThis 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)/..:$PATHHmmmm.
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
fiwould 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.