aboutsummaryrefslogtreecommitdiff
path: root/bpkg/manifest-utility.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-02-13 23:31:05 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-02-15 12:12:30 +0300
commit0e1deb6510594c896804b7409e2f33fd2d035e3d (patch)
tree5b5fbeaeceaa6720416ceb9a6ca79e5cab49e578 /bpkg/manifest-utility.cxx
parentfbc7f6db25c322ea0da0a13d080d07b84f8bc497 (diff)
Adapt to package/repository manifests API change
Diffstat (limited to 'bpkg/manifest-utility.cxx')
-rw-r--r--bpkg/manifest-utility.cxx45
1 files changed, 7 insertions, 38 deletions
diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx
index d697620..27e2553 100644
--- a/bpkg/manifest-utility.cxx
+++ b/bpkg/manifest-utility.cxx
@@ -86,45 +86,10 @@ namespace bpkg
// 1. If type is specified as an option use that (but validate
// incompatible scheme/type e.g., git/bpkg).
//
- // 2. If scheme is git then git.
+ // 2. See guess_type() function description in libbpkg/manifest.hxx for
+ // the algorithm details.
//
- // 3. If scheme is http(s), then check if path has the .git extension,
- // then git, otherwise bpkg.
- //
- // 4. If local (which will normally be without the .git extension), check
- // if directory contains the .git/ subdirectory then git, otherwise
- // bpkg.
- //
- repository_type t (repository_type::bpkg);
-
- if (ot)
- t = *ot;
- else
- {
- switch (u.scheme)
- {
- case repository_protocol::git:
- {
- t = repository_type::git;
- break;
- }
- case repository_protocol::http:
- case repository_protocol::https:
- {
- t = u.path->extension () == "git"
- ? repository_type::git
- : repository_type::bpkg;
- break;
- }
- case repository_protocol::file:
- {
- t = exists (path_cast<dir_path> (*u.path) / dir_path (".git"))
- ? repository_type::git
- : repository_type::bpkg;
- break;
- }
- }
- }
+ repository_type t (ot ? *ot : guess_type (u, true));
try
{
@@ -155,4 +120,8 @@ namespace bpkg
{
fail << "invalid repository path '" << s << "': " << e << endf;
}
+ catch (const system_error& e)
+ {
+ fail << "failed to guess repository type for '" << s << "': " << e << endf;
+ }
}