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

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

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Sep 20, 2007, 21:46 UTC
Message-ID
<20070920214609.GT16235@genesis.frugalware.org>
In-Reply-To
<Pine.LNX.4.64.0709201946410.28395@racer.site>
On Thu, Sep 20, 2007 at 07:47:32PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 17 quoted lines
> > > +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
Previous: Johannes SchindelinNext: Joel Becker
Message 19 of 28 in “[rfc] git submodules howto”
  1. Miklos VajnaSep 18, 2007
  2. Johannes SchindelinSep 18, 2007
  3. Michael SmithSep 18, 2007
  4. J. Bruce FieldsSep 18, 2007
  5. Miklos VajnaSep 18, 2007
  6. J. Bruce FieldsSep 18, 2007
  7. Miklos VajnaSep 18, 2007
  8. Michael SmithSep 18, 2007
  9. User Manual: add a chapter for submodulesMiklos Vajna, Sep 19, 2007
  10. Junio C HamanoSep 19, 2007
  11. J. Bruce FieldsSep 19, 2007
  12. User Manual: add a chapter for submodulesMiklos Vajna, Sep 20, 2007
  13. User Manual: add a chapter for submodulesMiklos Vajna, Sep 20, 2007
  14. Junio C HamanoSep 20, 2007
  15. Johannes SchindelinSep 20, 2007
  16. new test from the submodule chapter of the user manualMiklos Vajna, Sep 20, 2007
  17. Joel BeckerSep 20, 2007
  18. Johannes SchindelinSep 20, 2007
  19. Miklos VajnaSep 20, 2007
  20. Joel BeckerSep 20, 2007
  21. Junio C HamanoSep 20, 2007
  22. new test from the submodule chapter of the user manualMiklos Vajna, Sep 21, 2007
  23. Junio C HamanoSep 21, 2007
  24. new test from the submodule chapter of the user manualMiklos Vajna, Sep 22, 2007
  25. Miklos VajnaSep 20, 2007
  26. Sven VerdoolaegeSep 19, 2007
  27. Uwe Kleine-KönigSep 24, 2007
  28. Miklos VajnaSep 24, 2007

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.