From ad8d50be4016e68a4ab8d765bd9b45a9fdae1a6d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 4 Sep 2021 12:38:40 +0300 Subject: Simplify authenticate_*() and rep_fetch() functions semantics --- bpkg/auth.cxx | 10 ---------- bpkg/auth.hxx | 7 ++----- bpkg/rep-fetch.cxx | 5 ----- bpkg/rep-fetch.hxx | 7 +++---- bpkg/rep-info.cxx | 2 ++ 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/bpkg/auth.cxx b/bpkg/auth.cxx index 08f6b11..ca187ed 100644 --- a/bpkg/auth.cxx +++ b/bpkg/auth.cxx @@ -644,11 +644,6 @@ namespace bpkg if (co.trust_no () && co.trust_yes ()) fail << "--trust-yes and --trust-no are mutually exclusive"; - if (conf != nullptr && conf->empty ()) - conf = exists (bpkg_dir) ? ¤t_dir : nullptr; - - assert (conf == nullptr || !conf->empty ()); - shared_ptr r; if (conf == nullptr) @@ -694,11 +689,6 @@ namespace bpkg { tracer trace ("authenticate_repository"); - if (conf != nullptr && conf->empty ()) - conf = exists (bpkg_dir) ? ¤t_dir : nullptr; - - assert (conf == nullptr || !conf->empty ()); - path f; auto_rmfile rm; diff --git a/bpkg/auth.hxx b/bpkg/auth.hxx index c95d1c8..4cd2e56 100644 --- a/bpkg/auth.hxx +++ b/bpkg/auth.hxx @@ -15,11 +15,8 @@ namespace bpkg { // Authenticate a repository certificate. If the configuration directory is - // NULL, then perform without a certificate database. If it is empty, then - // check if the current working directory is a configuration. If it is, then - // use its certificate database. Otherwise, continue as if it was NULL. All - // other values (including '.') are assumed to be valid configuration paths - // and will be diagnosed if that's not the case. + // NULL, then perform without a certificate database. Otherwise, use its + // certificate database. // // If the dependent trust fingerprint is present then try to authenticate // the certificate for use by the dependent prior to prompting the user. diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index c000f05..a3480d0 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -403,11 +403,6 @@ namespace bpkg bool iu, bool ev) { - if (conf != nullptr && conf->empty ()) - conf = exists (bpkg_dir) ? ¤t_dir : nullptr; - - assert (conf == nullptr || !conf->empty ()); - auto i (temp_dir.find (conf != nullptr ? *conf : empty_dir_path)); assert (i != temp_dir.end ()); diff --git a/bpkg/rep-fetch.hxx b/bpkg/rep-fetch.hxx index 2445129..9a9a18e 100644 --- a/bpkg/rep-fetch.hxx +++ b/bpkg/rep-fetch.hxx @@ -18,9 +18,8 @@ namespace bpkg // Fetch and authenticate repositories and packages manifests. // - // If conf is NULL, then assume not running in a bpkg configuration. If it - // is empty, then check if the bpkg configuration exists in the current - // working directory. + // If configuration directory is NULL, then assume not running in a bpkg + // configuration. // class certificate; @@ -59,7 +58,7 @@ namespace bpkg // rep_fetch_data rep_fetch (const common_options&, - const dir_path* conf, + const dir_path* configuration, const repository_location&, bool ignore_unknown, bool expand_values); diff --git a/bpkg/rep-info.cxx b/bpkg/rep-info.cxx index 4e3315b..0000557 100644 --- a/bpkg/rep-info.cxx +++ b/bpkg/rep-info.cxx @@ -62,6 +62,8 @@ namespace bpkg if (conf != nullptr && conf->empty ()) conf = exists (bpkg_dir) ? ¤t_dir : nullptr; + assert (conf == nullptr || !conf->empty ()); + init_tmp (conf != nullptr ? *conf : empty_dir_path); rep_fetch_data rfd ( -- cgit v1.1