From: Miklos Vajna <vmiklos@frugalware.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
"J. Bruce Fields" <bfields@citi.umich.edu>
Subject: [PATCH] new test from the submodule chapter of the user manual
Date: Sat, 22 Sep 2007 22:05:35 +0200 [thread overview]
Message-ID: <20070922200535.GE24023@genesis.frugalware.org> (raw)
In-Reply-To: <7v1wcrki96.fsf@gitster.siamese.dyndns.org>
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Fri, Sep 21, 2007 at 11:04:05AM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> That's horrible. Please do not depend on object SHA1's to stay
> the same. If somebody makes a fix to the test to add a new file
> in a sample subproject it would break all the rest. Also please
> do not depend on the progress output.
okay, here is the third try. now checking for the result using diff-tree and
ls-files. hopefully i did what you expected :)
t/t3060-subprojects-tutorial.sh | 95 +++++++++++++++++++++++++++++++++++++++
1 files changed, 95 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..d46dded
--- /dev/null
+++ b/t/t3060-subprojects-tutorial.sh
@@ -0,0 +1,95 @@
+#!/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
+'
+
+mkdir super
+cd super
+cat >expected << EOF
+:000000 100644 00000... A .gitmodules
+:000000 160000 00000... A a
+:000000 160000 00000... A b
+:000000 160000 00000... A c
+:000000 160000 00000... A d
+EOF
+
+test_expect_success "create the superproject" '
+ git init &&
+ echo super > super.txt &&
+ git add super.txt &&
+ git commit -m "initial" &&
+ for i in a b c d
+ do
+ git submodule add '`pwd`'/../$i
+ done &&
+ git commit -m "Add submodules a, b, c and d." &&
+ git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
+ cmp expected current
+'
+
+test_expect_success "checking if the correct commit is stored in the superproject" '
+ for i in a b c d
+ do
+ git ls-files -s $i|cut -d " " -f 2 > $i.actual &&
+ (cd $i && git-rev-parse HEAD) > $i.expected &&
+ cmp $i.actual $i.expected
+ done &&
+ 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 "checking the result of the commit in the cloned project" '
+ for i in a b c d
+ do
+ git ls-files -s $i|cut -d " " -f 2 > $i.actual &&
+ (cd $i && git-rev-parse HEAD) > $i.expected &&
+ cmp $i.actual $i.expected
+ done
+'
+
+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_expect_success "checking the result of the commit in the updated cloned project" '
+ git ls-files -s a|cut -d " " -f 2 > a.actual &&
+ (cd a && git-rev-parse HEAD) > a.expected &&
+ cmp a.actual a.expected
+'
+test_done
--
1.5.3.2.80.g077d6f-dirty
next prev parent reply other threads:[~2007-09-22 20:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 10:55 [rfc] git submodules howto Miklos Vajna
2007-09-18 12:03 ` Johannes Schindelin
2007-09-18 12:10 ` Michael Smith
2007-09-18 13:29 ` J. Bruce Fields
2007-09-18 15:47 ` Miklos Vajna
2007-09-18 15:55 ` J. Bruce Fields
2007-09-18 16:11 ` Miklos Vajna
2007-09-18 18:12 ` Michael Smith
2007-09-19 17:42 ` [PATCH] User Manual: add a chapter for submodules Miklos Vajna
2007-09-19 19:44 ` Junio C Hamano
2007-09-19 20:30 ` J. Bruce Fields
2007-09-20 0:01 ` Miklos Vajna
2007-09-20 0:34 ` Miklos Vajna
2007-09-20 4:15 ` Junio C Hamano
2007-09-20 10:34 ` Johannes Schindelin
2007-09-20 17:08 ` [PATCH] new test from the submodule chapter of the user manual Miklos Vajna
2007-09-20 17:59 ` Joel Becker
2007-09-20 18:47 ` Johannes Schindelin
2007-09-20 21:46 ` Miklos Vajna
2007-09-20 22:56 ` Joel Becker
2007-09-20 21:35 ` Junio C Hamano
2007-09-21 13:09 ` Miklos Vajna
2007-09-21 18:04 ` Junio C Hamano
2007-09-22 20:05 ` Miklos Vajna [this message]
2007-09-20 22:02 ` [PATCH] User Manual: add a chapter for submodules Miklos Vajna
2007-09-19 21:00 ` Sven Verdoolaege
2007-09-24 7:11 ` [rfc] git submodules howto Uwe Kleine-König
2007-09-24 8:30 ` Miklos Vajna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070922200535.GE24023@genesis.frugalware.org \
--to=vmiklos@frugalware.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=bfields@citi.umich.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).