summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-06-01 22:07:59 +0000
committerMichał Górny <mgorny@gentoo.org>2014-06-01 22:07:59 +0000
commitcce4e5c08babe006f5c1b9f7407f005a07801278 (patch)
tree8b09880b1c12de21f98333686c1a0e0188bd9f99 /eclass/tests
parentversion bump #484128 (diff)
downloadgentoo-2-cce4e5c08babe006f5c1b9f7407f005a07801278.tar.gz
gentoo-2-cce4e5c08babe006f5c1b9f7407f005a07801278.tar.bz2
gentoo-2-cce4e5c08babe006f5c1b9f7407f005a07801278.zip
Properly canonicalize relative submodule URIs, bug #501250.
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/git-r3:subrepos.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/eclass/tests/git-r3:subrepos.sh b/eclass/tests/git-r3:subrepos.sh
new file mode 100755
index 000000000000..0fa0fb13e11d
--- /dev/null
+++ b/eclass/tests/git-r3:subrepos.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+source tests-common.sh
+
+inherit git-r3
+
+# Test getting submodule URIs
+test_subrepos() {
+ local suburi=${1}
+ local expect=( "${@:2}" )
+
+ tbegin "subrepos for ${suburi} -> ${expect[0]}${expect[1]+...}"
+
+ local subrepos
+ _git-r3_set_subrepos "${suburi}" "${repos[@]}"
+
+ [[ ${expect[@]} == ${subrepos[@]} ]]
+ tend ${?} || eerror "Expected: ${expect[@]}, got: ${subrepos[@]}"
+}
+
+# parent repos
+repos=( http://foohub/fooman/foo.git git://foohub/fooman/foo.git )
+
+# absolute URI
+test_subrepos http://foo/bar http://foo/bar
+test_subrepos /foo/bar /foo/bar
+
+# plain relative URI
+test_subrepos ./baz http://foohub/fooman/foo.git/baz git://foohub/fooman/foo.git/baz
+
+# backward relative URIs
+test_subrepos ../baz.git http://foohub/fooman/baz.git git://foohub/fooman/baz.git
+test_subrepos ../../bazman/baz.git http://foohub/bazman/baz.git git://foohub/bazman/baz.git
+
+texit