git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Seymour <jon.seymour@gmail.com>
To: git@vger.kernel.org
Cc: Jens.Lehmann@web.de, gitster@pobox.com, phil.hord@gmail.com,
	ramsay@ramsay1.demon.co.uk, Jon Seymour <jon.seymour@gmail.com>
Subject: [PATCH v6 4/9] submodule: document failure to handle improperly normalized remote origin URLs
Date: Sun, 27 May 2012 23:43:25 +1000	[thread overview]
Message-ID: <1338126210-11517-5-git-send-email-jon.seymour@gmail.com> (raw)
In-Reply-To: <1338126210-11517-1-git-send-email-jon.seymour@gmail.com>

These tests document failures to properly handle improperly normalized
remote origin URLs.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
 t/t7400-submodule-basic.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)

diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 80ec0f7..2674088 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -499,6 +499,39 @@ test_expect_success '../subrepo works with URL - ssh://hostname/repo' '
 	)
 '
 
+test_expect_failure 'relative path works with URL - ssh://hostname/path/././repo' '
+	(
+		cd reltest &&
+		cp pristine-.git-config .git/config &&
+		cp pristine-.gitmodules .gitmodules &&
+		git config remote.origin.url ssh://hostname/path/././repo &&
+		git submodule init &&
+		test "$(git config submodule.sub.url)" = ssh://hostname/path/subrepo
+	)
+'
+
+test_expect_failure 'relative path works with URL - ssh://hostname/path/detour/././../repo' '
+	(
+		cd reltest &&
+		cp pristine-.git-config .git/config &&
+		cp pristine-.gitmodules .gitmodules &&
+		git config remote.origin.url ssh://hostname/path/detour/././../repo &&
+		git submodule init &&
+		test "$(git config submodule.sub.url)" = ssh://hostname/path/subrepo
+	)
+'
+
+test_expect_failure 'relative path works with URL - ssh://hostname/path/repo/.' '
+	(
+		cd reltest &&
+		cp pristine-.git-config .git/config &&
+		cp pristine-.gitmodules .gitmodules &&
+		git config remote.origin.url ssh://hostname/path/repo/. &&
+		git submodule init &&
+		test "$(git config submodule.sub.url)" = ssh://hostname/path/subrepo
+	)
+'
+
 test_expect_success '../subrepo works with port-qualified URL - ssh://hostname:22/repo' '
 	(
 		cd reltest &&
@@ -634,6 +667,50 @@ test_expect_success '../subrepo works with scp-style URL - user@host:path/to/rep
 	)
 '
 
+test_expect_failure 'relative path works with user@host:path/to/repo/.' '
+	(
+		cd reltest &&
+		cp pristine-.git-config .git/config &&
+		cp pristine-.gitmodules .gitmodules &&
+		git config remote.origin.url user@host:path/to/repo/. &&
+		git submodule init &&
+		test "$(git config submodule.sub.url)" = user@host:path/to/subrepo
+	)
+'
+
+test_expect_failure 'relative path works with user@host:path/to/./repo' '
+	(
+		cd reltest &&
+		cp pristine-.git-config .git/config &&
+		cp pristine-.gitmodules .gitmodules &&
+		git config remote.origin.url user@host:path/to/./repo &&
+		git submodule init &&
+		test "$(git config submodule.sub.url)" = user@host:path/to/subrepo
+	)
+'
+
+test_expect_failure 'relative path works with user@host:path/to/././repo' '
+	(
+		cd reltest &&
+		cp pristine-.git-config .git/config &&
+		cp pristine-.gitmodules .gitmodules &&
+		git config remote.origin.url user@host:path/to/././repo &&
+		git submodule init &&
+		test "$(git config submodule.sub.url)" = user@host:path/to/subrepo
+	)
+'
+
+test_expect_failure 'relative path works with user@host:path/to/detour/../repo' '
+	(
+		cd reltest &&
+		cp pristine-.git-config .git/config &&
+		cp pristine-.gitmodules .gitmodules &&
+		git config remote.origin.url user@host:path/to/detour/../repo &&
+		git submodule init &&
+		test "$(git config submodule.sub.url)" = user@host:path/to/subrepo
+	)
+'
+
 test_expect_failure '../subrepo works with relative local path - foo' '
 	(
 		cd reltest &&
@@ -703,6 +780,17 @@ test_expect_success '../subrepo works with relative local path - ../foo/bar' '
 	)
 '
 
+test_expect_failure 'relative path works with ../foo/./bar' '
+	(
+		cd reltest &&
+		cp pristine-.git-config .git/config &&
+		cp pristine-.gitmodules .gitmodules &&
+		git config remote.origin.url ../foo/./bar &&
+		git submodule init &&
+		test "$(git config submodule.sub.url)" = ../foo/subrepo
+	)
+'
+
 test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.git' '
 	(
 		cd reltest &&
-- 
1.7.10.2.656.gb5a46db

  parent reply	other threads:[~2012-05-27 13:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-27 13:43 [PATCH v6 0/9] submodule: improve robustness of path handling Jon Seymour
2012-05-27 13:43 ` [PATCH v6 1/9] submodule: additional regression tests for relative URLs Jon Seymour
2012-05-27 13:43 ` [PATCH v6 2/9] submodule: document failure to detect invalid submodule URLs Jon Seymour
2012-05-27 13:43 ` [PATCH v6 3/9] submodule: document failure to handle relative superproject origin URLs Jon Seymour
2012-05-27 13:43 ` Jon Seymour [this message]
2012-05-27 13:43 ` [PATCH v6 5/9] submodule: extract normalize_path into standalone function Jon Seymour
2012-05-27 13:43 ` [PATCH v6 6/9] submodule: fix detection of invalid submodule URL Jon Seymour
2012-05-27 13:43 ` [PATCH v6 7/9] submodule: fix sync handling of relative superproject origin URLs Jon Seymour
2012-05-27 13:55   ` Jon Seymour
2012-05-27 13:43 ` [PATCH v6 8/9] submodule: fix handling of denormalized " Jon Seymour
2012-05-27 14:38   ` Jon Seymour
2012-05-27 13:43 ` [PATCH v6 9/9] submodule: fix normalization to handle repeated ./ 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=1338126210-11517-5-git-send-email-jon.seymour@gmail.com \
    --to=jon.seymour@gmail.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phil.hord@gmail.com \
    --cc=ramsay@ramsay1.demon.co.uk \
    /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).