From: Junio C Hamano <hidden> Date: 2016-06-15 22:43:35
Miklos Vajna [off-list ref] writes:
Signed-off-by: Michael Smith <redacted>
Signed-off-by: Miklos Vajna <redacted>
---
Sorry, I sent the original patch again. So here is the updated second version.
Looks Ok to me, although I didn't verify the examples by
actually running them myself this time (last round I did).
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:35
Hi,
On Wed, 19 Sep 2007, Junio C Hamano wrote:
Miklos Vajna [off-list ref] writes:
quoted
Signed-off-by: Michael Smith <redacted>
Signed-off-by: Miklos Vajna <redacted>
---
Sorry, I sent the original patch again. So here is the updated second version.
Looks Ok to me, although I didn't verify the examples by
actually running them myself this time (last round I did).
So maybe we should do the same as with the tutorial: stick the examples
into a test script?
Ciao,
Dscho
@@ -0,0 +1,62 @@+#!/bin/sh+#+# Copyright (c) 2007 Miklos Vajna+#++test_description='A simple subprojects tutorial in the form of a test case'++../test-lib.sh++test_expect_success"create the submodules"'+foriinabcd+do+mkdir$i&&+cd$i&&+gitinit&&+echo"module $i">$i.txt&&+gitadd$i.txt&&+gitcommit-m"Initial commit, submodule $i"&&+cd..+done+'++test_expect_success"create the superproject"'+mkdirsuper&&+cdsuper&&+gitinit&&+foriinabcd+do+gitsubmoduleadd'`pwd`'/$i+done+'++test_expect_success"commit in the superproject"'+gitcommit-m"Add submodules a, b, c and d."&&+cd..+'++test_expect_success"clone the superproject"'+gitclonesupercloned&&+cdcloned+'++test_expect_success"submodule init"'+gitsubmoduleinit+'++test_expect_success"submodule update"'+gitsubmoduleupdate+'++test_expect_success"update the submodule from within the superproject"'+cda&&+echo"adding a line again">>a.txt&&+gitcommit-a-m"Updated the submodule from within the superproject."&&+gitpush&&+cd..&&+gitadda&&+gitcommit-m"Updated submodule a."&&+gitpush+'++test_done
From: Joel Becker <hidden> Date: 2016-06-15 22:43:35
On Thu, Sep 20, 2007 at 07:08:31PM +0200, Miklos Vajna 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...
Joel
--
"Sometimes when reading Goethe I have the paralyzing suspicion
that he is trying to be funny."
- Guy Davenport
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:35
Hi,
On Thu, 20 Sep 2007, Joel Becker wrote:
On Thu, Sep 20, 2007 at 07:08:31PM +0200, Miklos Vajna wrote:
quoted
+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.
Ciao,
Dscho
On Thu, Sep 20, 2007 at 07:47:32PM +0100, Johannes Schindelin [off-list ref] wrote:
quoted
quoted
+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
From: Joel Becker <hidden> Date: 2016-06-15 22:43:36
On Thu, Sep 20, 2007 at 07:47:32PM +0100, Johannes Schindelin wrote:
quoted
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.
Oh, drat. It's run in eval, not a subshell.
Joel
--
Life's Little Instruction Book #94
"Make it a habit to do nice things for people who
will never find out."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127