From: Jens Lehmann <Jens.Lehmann@web.de>
To: Jon Seymour <jon.seymour@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH v4 1/2] submodule: document handling of relative superproject origin URLs
Date: Wed, 23 May 2012 22:58:16 +0200 [thread overview]
Message-ID: <4FBD4F68.90305@web.de> (raw)
In-Reply-To: <1337791554-31294-2-git-send-email-jon.seymour@gmail.com>
Maybe the subject should rather be:
"submodule: document failures handling relative superproject origin URLs"
Am 23.05.2012 18:45, schrieb Jon Seymour:
> These tests document how submodule sync and init handle various
> kinds of relative super project origin URLs. The submodule URL
> path is ../subrepo.
>
> 6 cases are documented:
> foo
> foo/bar
> ./foo
> ./foo/bar
> ../foo
> ../foo/bar
Nice test coverage!
> Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
> ---
> t/t7400-submodule-basic.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++
> t/t7403-submodule-sync.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 124 insertions(+), 1 deletion(-)
>
> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> index 81827e6..97e7a73 100755
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
> @@ -507,6 +507,68 @@ test_expect_success 'relative path works with user@host:path' '
> )
> '
But please use test_expect_failure for all tests that fail due to
current bugs and document what should succeed in the commands used
inside the test case (just like you did in v3). The only change
needed when the bug is fixed should be changing each
test_expect_failure to test_expect_success.
> +test_expect_success 'relative path works with foo' "
> + (
> + cd reltest &&
> + cp pristine-.git-config .git/config &&
> + git config remote.origin.url foo &&
> + echo \"cannot strip one component off url 'foo'\" >expect &&
> + test_must_fail git submodule init 2>actual &&
> + cat actual &&
> + test_cmp expect actual
> + )
> +"
> +
> +test_expect_success 'relative path works with foo/bar' '
> + (
> + cd reltest &&
> + cp pristine-.git-config .git/config &&
> + git config remote.origin.url foo/bar &&
> + git submodule init &&
> + test "$(git config submodule.sub.url)" = foo/subrepo
> + )
> +'
> +
> +test_expect_success 'relative path works with ./foo' '
> + (
> + cd reltest &&
> + cp pristine-.git-config .git/config &&
> + git config remote.origin.url ./foo &&
> + git submodule init &&
> + test "$(git config submodule.sub.url)" = ./subrepo
> + )
> +'
> +
> +test_expect_success 'relative path works with ./foo/bar' '
> + (
> + cd reltest &&
> + cp pristine-.git-config .git/config &&
> + git config remote.origin.url ./foo/bar &&
> + git submodule init &&
> + test "$(git config submodule.sub.url)" = ./foo/subrepo
> + )
> +'
> +
> +test_expect_success 'relative path works with ../foo' '
> + (
> + cd reltest &&
> + cp pristine-.git-config .git/config &&
> + git config remote.origin.url ../foo &&
> + git submodule init &&
> + test "$(git config submodule.sub.url)" = ../subrepo
> + )
> +'
> +
> +test_expect_success 'relative path works with ../foo/bar' '
> + (
> + cd reltest &&
> + cp pristine-.git-config .git/config &&
> + git config remote.origin.url ../foo/bar &&
> + git submodule init &&
> + test "$(git config submodule.sub.url)" = ../foo/subrepo
> + )
> +'
> +
> test_expect_success 'moving the superproject does not break submodules' '
> (
> cd addtest &&
> diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
> index 3620215..3784c9b 100755
> --- a/t/t7403-submodule-sync.sh
> +++ b/t/t7403-submodule-sync.sh
> @@ -26,7 +26,9 @@ test_expect_success setup '
> (cd super-clone && git submodule update --init) &&
> git clone super empty-clone &&
> (cd empty-clone && git submodule init) &&
> - git clone super top-only-clone
> + git clone super top-only-clone &&
> + git clone super relative-clone &&
> + (cd relative-clone && git submodule update --init)
> '
>
> test_expect_success 'change submodule' '
> @@ -86,4 +88,63 @@ test_expect_success '"git submodule sync" should not vivify uninteresting submod
> )
> '
>
> +test_expect_success '"git submodule sync" handles origin URL of the form foo' "
> + (cd relative-clone &&
> + git remote set-url origin foo
> + echo \"cannot strip one component off url 'foo'\" > expect &&
> + test_must_fail git submodule sync 2> actual &&
> + test_cmp expect actual
> + )
> +"
> +
> +test_expect_success '"git submodule sync" handles origin URL of the form foo/bar' '
> + (cd relative-clone &&
> + git remote set-url origin foo/bar
> + git submodule sync &&
> + (cd submodule &&
> + test "$(git config remote.origin.url)" == "foo/submodule"
> + )
> + )
> +'
> +
> +test_expect_success '"git submodule sync" handles origin URL of the form ./foo' '
> + (cd relative-clone &&
> + git remote set-url origin ./foo
> + git submodule sync &&
> + (cd submodule &&
> + test "$(git config remote.origin.url)" == "./submodule"
> + )
> + )
> +'
> +
> +test_expect_success '"git submodule sync" handles origin URL of the form ./foo/bar' '
> + (cd relative-clone &&
> + git remote set-url origin ./foo/bar
> + git submodule sync &&
> + (cd submodule &&
> + test "$(git config remote.origin.url)" == "./foo/submodule"
> + )
> + )
> +'
> +
> +test_expect_success '"git submodule sync" handles origin URL of the form ../foo' '
> + (cd relative-clone &&
> + git remote set-url origin ../foo
> + git submodule sync &&
> + (cd submodule &&
> + test "$(git config remote.origin.url)" == "../submodule"
> + )
> + )
> +'
> +
> +test_expect_success '"git submodule sync" handles origin URL of the form ../foo/bar' '
> + (cd relative-clone &&
> + git remote set-url origin ../foo/bar
> + git submodule sync &&
> + (cd submodule &&
> + test "$(git config remote.origin.url)" == "../foo/submodule"
> + )
> + )
> +'
> +
> test_done
next prev parent reply other threads:[~2012-05-23 20:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 16:45 [PATCH v4 0/2] submodule: fix handling of relative superproject origin URLs Jon Seymour
2012-05-23 16:45 ` [PATCH v4 1/2] submodule: document " Jon Seymour
2012-05-23 20:58 ` Jens Lehmann [this message]
2012-05-23 21:14 ` Junio C Hamano
2012-05-23 21:45 ` Jens Lehmann
2012-05-23 21:55 ` Jon Seymour
2012-05-23 16:45 ` [PATCH v4 2/2] submodule: fix " Jon Seymour
2012-05-23 21:50 ` Jens Lehmann
2012-05-23 22:17 ` Jon Seymour
2012-05-24 2:32 ` Jon Seymour
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FBD4F68.90305@web.de \
--to=jens.lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jon.seymour@gmail.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.
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 NNTP newsgroup(s).