Re: [PATCH] User Manual: add a chapter for submodules

8 messages, 4 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] User Manual: add a chapter for submodules

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

Re: [PATCH] User Manual: add a chapter for submodules

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

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

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:35

Signed-off-by: Miklos Vajna <redacted>
---

On Thu, Sep 20, 2007 at 11:34:25AM +0100, Johannes Schindelin [off-list ref] wrote:
On Wed, 19 Sep 2007, Junio C Hamano wrote:
quoted
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?
what about this?

 t/t3060-subprojects-tutorial.sh |   62 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100755 t/t3060-subprojects-tutorial.sh
diff --git a/t/t3060-subprojects-tutorial.sh b/t/t3060-subprojects-tutorial.sh
new file mode 100755
index 0000000..2fcf4ab
--- /dev/null
+++ b/t/t3060-subprojects-tutorial.sh
@@ -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" '
+	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
+'
+
+test_expect_success "create the superproject" '
+	mkdir super &&
+	cd super &&
+	git init &&
+	for i in a b c d
+	do
+		git submodule add '`pwd`'/$i
+	done
+'
+
+test_expect_success "commit in the superproject" '
+	git commit -m "Add submodules a, b, c and d." &&
+	cd ..
+'
+
+test_expect_success "clone the superproject" '
+	git clone super cloned &&
+	cd cloned
+'
+
+test_expect_success "submodule init" '
+	git submodule init
+'
+
+test_expect_success "submodule update" '
+	git submodule update
+'
+
+test_expect_success "update the submodule from within the superproject" '
+	cd a &&
+	echo "adding a line again" >> a.txt &&
+	git commit -a -m "Updated the submodule from within the superproject." &&
+	git push &&
+	cd .. &&
+	git add a &&
+	git commit -m "Updated submodule a." &&
+	git push
+'
+
+test_done
-- 
1.5.3.2.80.g077d6f-dirty

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

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

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

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

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

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:36

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

Re: [PATCH] User Manual: add a chapter for submodules

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:43:36

On Wed, Sep 19, 2007 at 09:15:58PM -0700, Junio C Hamano [off-list ref] wrote:
Looks Ok to me, although I didn't verify the examples by
actually running them myself this time (last round I did).
just wanted to mention that i did verify them before sending the patch.

- VMiklos

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

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help