@@ -25,9 +25,11 @@ import io.kotest.core.annotation.Tags
2525import io.kotest.core.spec.style.WordSpec
2626import io.kotest.engine.spec.tempdir
2727import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder
28+ import io.kotest.matchers.concurrent.shouldCompleteWithin
2829import io.kotest.matchers.shouldBe
2930
3031import java.io.File
32+ import java.util.concurrent.TimeUnit
3133
3234import org.ossreviewtoolkit.downloader.DownloadException
3335import org.ossreviewtoolkit.model.Identifier
@@ -149,5 +151,73 @@ class GitFunTest : WordSpec({
149151 "specs/dep_graph_spec.js"
150152 )
151153 }
154+
155+ " apply URL replacements recursively" {
156+ val url = " https://github.com/oss-review-toolkit/ort-test-data-git-submodules.git"
157+ val pkg = Package .EMPTY .copy(vcsProcessed = VcsInfo (VcsType .GIT , url, "git-protocol-submodule-urls"))
158+
159+ // Using GitHub with the deprecated "git://" protocol actually hangs instead of failing explicitly.
160+ val workingTree = shouldCompleteWithin(40, TimeUnit .SECONDS ) {
161+ git.download(pkg, outputDir, allowMovingRevisions = true)
162+ }
163+
164+ workingTree.isValid() shouldBe true
165+ workingTree.getRootPath().walk().onEnter {
166+ it == outputDir || it.parentFile.resolve(".gitmodules").isFile
167+ }.mapNotNullTo(mutableListOf()) { file ->
168+ file.toRelativeString(outputDir).takeIf { it.isNotEmpty() && !it.startsWith('.') }
169+ }.shouldContainExactlyInAnyOrder(
170+ "commons-text",
171+ "test-data-npm",
172+ "LICENSE ",
173+ "README .md",
174+
175+ "commons-text/.git",
176+ "commons-text/.gitignore",
177+ "commons-text/.travis.yml",
178+ "commons-text/CONTRIBUTING .md",
179+ "commons-text/LICENSE .txt",
180+ "commons-text/NOTICE .txt",
181+ "commons-text/README .md",
182+ "commons-text/RELEASE -NOTES .txt",
183+ "commons-text/checkstyle-suppressions.xml",
184+ "commons-text/checkstyle.xml",
185+ "commons-text/license-header.txt",
186+ "commons-text/pom.xml",
187+ "commons-text/sb-excludes.xml",
188+
189+ "test-data-npm/isarray",
190+ "test-data-npm/long.js",
191+ "test-data-npm/.git",
192+ "test-data-npm/.gitignore",
193+ "test-data-npm/.gitmodules",
194+ "test-data-npm/LICENSE ",
195+ "test-data-npm/README .md",
196+ "test-data-npm/package-lock.json",
197+ "test-data-npm/package.json",
198+
199+ "test-data-npm/isarray/.git",
200+ "test-data-npm/isarray/.gitignore",
201+ "test-data-npm/isarray/.travis.yml",
202+ "test-data-npm/isarray/LICENSE ",
203+ "test-data-npm/isarray/Makefile ",
204+ "test-data-npm/isarray/README .md",
205+ "test-data-npm/isarray/component.json",
206+ "test-data-npm/isarray/index.js",
207+ "test-data-npm/isarray/package-lock.json",
208+ "test-data-npm/isarray/package.json",
209+ "test-data-npm/isarray/test.js",
210+
211+ "test-data-npm/long.js/.git",
212+ "test-data-npm/long.js/.gitignore",
213+ "test-data-npm/long.js/.travis.yml",
214+ "test-data-npm/long.js/LICENSE ",
215+ "test-data-npm/long.js/README .md",
216+ "test-data-npm/long.js/bower.json",
217+ "test-data-npm/long.js/index.js",
218+ "test-data-npm/long.js/package.json",
219+ "test-data-npm/long.js/webpack.config.js"
220+ )
221+ }
152222 }
153223})
0 commit comments