From 0e1deb6510594c896804b7409e2f33fd2d035e3d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 13 Feb 2018 23:31:05 +0300 Subject: Adapt to package/repository manifests API change --- bpkg/manifest-utility.cxx | 45 +++++++-------------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) (limited to 'bpkg/manifest-utility.cxx') 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 (*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; + } } -- cgit v1.1