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]

 



On Mon, 25 Feb 2008, Junio C Hamano wrote:

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

This is supposed to be: don't complain if .git/hooks already doesn't 
exist; also, create .git/info if it doesn't exist. What is the right style 
for that? I've been only reading git shell code and writing C, other than 
this little bit.

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

That doesn't make test_create_repo() work right. Is there some reason it's 
currently using it with an explicit path, or is that just a legacy of when 
it wasn't running the git that gets tested in general? With that 
simplified, it seems to work this way, I think, and that's almost 
certainly the right thing to do.

There's additionally the problem that things which are built for testing 
in the git directory won't be installed anywhere. One possibility would be 
to put $(pwd)/.. at the end of the PATH (instead of the start), but I 
think it would be cleanest to put the built test tools somewhere else and 
include that directory in the PATH no matter what. Does this sound like 
the right track?

	-Daniel
*This .sig left intentionally blank*
-
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