aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbpkg/manifest.cxx30
-rw-r--r--libbpkg/manifest.hxx9
-rw-r--r--tests/manifest/testscript32
3 files changed, 35 insertions, 36 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx
index dc488de..af2a889 100644
--- a/libbpkg/manifest.cxx
+++ b/libbpkg/manifest.cxx
@@ -2062,13 +2062,14 @@ namespace bpkg
}
case repository_protocol::http:
case repository_protocol::https:
- {
- return url.path->extension () == "git"
- ? repository_type::git
- : repository_type::pkg;
- }
case repository_protocol::file:
{
+ if (url.path->extension () == "git")
+ return repository_type::git;
+
+ if (url.scheme != repository_protocol::file) // HTTP(S)?
+ return repository_type::pkg;
+
return local &&
dir_exists (path_cast<dir_path> (*url.path) / dir_path (".git"))
? repository_type::git
@@ -2751,25 +2752,8 @@ namespace bpkg
{
repository_url u (move (location->value));
- // If the prerequisite repository type is not specified explicitly then
- // we consider it to be the base repository type for the relative
- // location or guess it otherwise.
- //
if (!type)
- {
- if (u.scheme == repository_protocol::file && u.path->relative ())
- {
- type = base_type;
-
- // Strip the URL fragment if the base repository type is dir (see
- // the Repository Manifest documentation for the gory details).
- //
- if (base_type == repository_type::dir)
- u.fragment = nullopt;
- }
- else
- type = guess_type (u, false); // Can't throw.
- }
+ type = guess_type (u, false); // Can't throw.
// Call prerequisite repository location constructor, do not amend
// relative path.
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx
index fc6c332..59359b4 100644
--- a/libbpkg/manifest.hxx
+++ b/libbpkg/manifest.hxx
@@ -616,11 +616,12 @@ namespace bpkg
//
// 1. If scheme is git then git.
//
- // 2. If scheme is http(s), then check if path has the .git extension,
- // then git, otherwise pkg.
+ // 2. If path has the .git extension then git.
//
- // 3. If local (which will normally be without the .git extension), check
- // if directory contains the .git/ subdirectory then git, otherwise pkg.
+ // 3. If scheme is http(s) then pkg.
+ //
+ // 4. If local, check if directory contains the .git/ subdirectory then
+ // git, otherwise pkg.
//
// Can throw system_error in the later case.
//
diff --git a/tests/manifest/testscript b/tests/manifest/testscript
index 9d80bd6..77a27ea 100644
--- a/tests/manifest/testscript
+++ b/tests/manifest/testscript
@@ -293,7 +293,10 @@
location: http://example.org/math.git#master
role: prerequisite
:
- location: ../stable.git
+ location: ../stable
+ role: complement
+ :
+ location: ../unstable.git
role: complement
:
location: git://example.org/foo#master
@@ -311,10 +314,14 @@
type: git
role: prerequisite
:
- location: ../stable.git
+ location: ../stable
type: pkg
role: complement
:
+ location: ../unstable.git
+ type: git
+ role: complement
+ :
location: git://example.org/foo#master
type: git
role: prerequisite
@@ -344,6 +351,10 @@
type: git
role: complement
:
+ location: ../unstable.git
+ type: git
+ role: complement
+ :
url: http://cppget.org
email: repoman@cppget.org; General mailing list.
summary: General C++ package repository
@@ -365,6 +376,11 @@
role: complement
fragment: ca602c2d46b0dca7a9ebc856871767b0ba6b74f3
:
+ location: ../unstable.git
+ type: git
+ role: complement
+ fragment: ca602c2d46b0dca7a9ebc856871767b0ba6b74f3
+ :
location: http://example.org/math.git#master
type: git
role: prerequisite
@@ -439,21 +455,19 @@
: prerequisite-with-fragment
:
- $* -dr <<EOI >>EOO
+ $* -dr <<EOI 2>>EOE != 0
: 1
location: ../stable.git#stable
- role: complement
- :
- EOI
- : 1
- location: ../stable.git
type: dir
role: complement
:
- EOO
+ EOI
+ stdin:2:11: error: unexpected fragment for dir repository
+ EOE
}
}
+
: signature
:
: Roundtrip the signature manifest.