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: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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Linus Torvalds | Linux 2.6.27-rc8 |
| Andi Kleen | [PATCH x86] [2/16] Add a counter for per cpu clocksource watchdog checks and repor... |
| David Miller | Slow DOWN, please!!! |
| Greg KH | Re: [Patch v2] Make PCI extended config space (MMCONFIG) a driver opt-in |
git: | |
| Jeff King | Re: [PATCH] Color support added to git-add--interactive. |
| Yann Dirson | Re: irc usage.. |
| Peter Stahlir | Git as a filesystem |
| Junio C Hamano | Re: [PATCH 3/3] Teach "git branch" about --new-workdir |
| new_guy | Code signing in OpenBSD |
| Jason Dixon | Wasting our Freedom |
| Nick Guenther | Re: Real men don't attack straw men |
| Daniel Ouellet | identifying sparse files and get ride of them trick available? |
| Wolfgang Walter | Re: Kernel oops with 2.6.26, padlock and ipsec: probably problem with fpu state ch... |
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Tomasz Grobelny | [PATCH 0/5] [DCCP]: Queuing policies |
| Arjan van de Ven | Re: [GIT]: Networking |
| high memory | 7 hours ago | Linux kernel |
| semaphore access speed | 10 hours ago | Applications and Utilities |
| the kernel how to power off the machine | 11 hours ago | Linux kernel |
| Easter Eggs in windows XP | 14 hours ago | Windows |
| Shared swap partition | 15 hours ago | Linux general |
| Root password | 15 hours ago | Linux general |
| Where/when DNOTIFY is used? | 17 hours ago | Linux kernel |
| How to convert Linux Kernel built-in module into a loadable module | 19 hours ago | Linux kernel |
| Linux 2.6.24 and I/O schedulers | 20 hours ago | Linux kernel |
| USB Driver -- Interrupt Polling -- A Little Help Please | 1 day ago | Linux general |
