aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-09-04 12:38:40 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-09-04 20:35:03 +0300
commitad8d50be4016e68a4ab8d765bd9b45a9fdae1a6d (patch)
tree2fd90cf0434b2c81f69067352aa2c6fcf5af04ec
parent7bb44980ced46506c10bad333f526b7bc62ea1db (diff)
Simplify authenticate_*() and rep_fetch() functions semantics
-rw-r--r--bpkg/auth.cxx10
-rw-r--r--bpkg/auth.hxx7
-rw-r--r--bpkg/rep-fetch.cxx5
-rw-r--r--bpkg/rep-fetch.hxx7
-rw-r--r--bpkg/rep-info.cxx2
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) ? &current_dir : nullptr;
-
- assert (conf == nullptr || !conf->empty ());
-
shared_ptr<certificate> r;
if (conf == nullptr)
@@ -694,11 +689,6 @@ namespace bpkg
{
tracer trace ("authenticate_repository");
- if (conf != nullptr && conf->empty ())
- conf = exists (bpkg_dir) ? &current_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) ? &current_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) ? &current_dir : nullptr;
+ assert (conf == nullptr || !conf->empty ());
+
init_tmp (conf != nullptr ? *conf : empty_dir_path);
rep_fetch_data rfd (