Re: [PATCH] new test from the submodule chapter of the user manual

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

 



On Thu, Sep 20, 2007 at 07:47:32PM +0100, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
> > > +test_expect_success "create the submodules" '
> > > +	for i in a b c d
> > > +	do
> > > +		mkdir $i &&
> > > +		cd $i &&
> > > +		git init &&
> > > +		echo "module $i" > $i.txt &&
> > > +		git add $i.txt &&
> > > +		git commit -m "Initial commit, submodule $i" &&
> > > +		cd ..
> > > +	done
> > 
> > 	Silly question: why use the '&&' when you can 'set -e'?  As it
> > currently stands, a failure will still go back around the loop...
> 
> A "set -e" will make the script exit AFAIR.  That's not what we want.  A 
> simple "|| break" after the "cd .." will work, though.

i know i asked this on irc, but i still a bit confused. the target would
be to jump out from the loop and return 'false' if any of the items
fails

if i understand correctly then this is what Dscho proposes:

$ for i in a b; do echo $i && false || break; done
a
$ echo $?
0

this jumps out from the loop but does not return false

here is my version:

$ for i in a b; do echo $i && false; done
a
b

$ echo $?
1

this one detects the error but does not jump out from the loop. none of
them is perfect, but at least my version fails as long as the last cycle
fails (which is not problem as i think in most cases all or none of the
cycles will fail)

anyway, if you really want, i can change it, but i think it is not the
right thing to do

- VMiklos

Attachment: pgpMJ5cxAiFJn.pgp
Description: PGP signature


[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