aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-07-09 17:23:00 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-07-09 18:11:23 +0300
commitab8c659fd2e7d1938740472327cf56843e4fd90a (patch)
tree89c17f192b17ffa3de0bd5ae2e8525f3c47130eb
parenteeb4dd62fe81070217511a754ca539325bdd9d78 (diff)
Adapt to repository_url(string) ctor throwing invalid_argument for empty string
-rw-r--r--bpkg/manifest-utility.cxx4
-rw-r--r--bpkg/package.hxx6
-rw-r--r--bpkg/rep-remove.cxx4
-rw-r--r--tests/rep-add.test2
4 files changed, 5 insertions, 11 deletions
diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx
index fcda389..484ba32 100644
--- a/bpkg/manifest-utility.cxx
+++ b/bpkg/manifest-utility.cxx
@@ -93,10 +93,6 @@ namespace bpkg
try
{
repository_url u (s);
-
- if (u.empty ())
- fail << "empty repository location";
-
assert (u.path);
// Make the relative path absolute using the current directory.
diff --git a/bpkg/package.hxx b/bpkg/package.hxx
index 6b19203..ea48045 100644
--- a/bpkg/package.hxx
+++ b/bpkg/package.hxx
@@ -231,9 +231,9 @@ namespace bpkg
repository_type type;
};
- #pragma db map type(repository_url) as(string) \
- to((?).string ()) \
- from(bpkg::repository_url (?))
+ #pragma db map type(repository_url) as(string) \
+ to((?).string ()) \
+ from((?).empty () ? bpkg::repository_url () : bpkg::repository_url (?))
#pragma db map type(repository_type) as(string) \
to(to_string (?)) \
diff --git a/bpkg/rep-remove.cxx b/bpkg/rep-remove.cxx
index 192fe47..c070418 100644
--- a/bpkg/rep-remove.cxx
+++ b/bpkg/rep-remove.cxx
@@ -433,9 +433,7 @@ namespace bpkg
try
{
repository_url u (a);
-
- if (u.empty ())
- fail << "empty repository location";
+ assert (!u.empty ());
for (const lazy_shared_ptr<repository>& rp: ua)
{
diff --git a/tests/rep-add.test b/tests/rep-add.test
index f53724c..8c4b9f9 100644
--- a/tests/rep-add.test
+++ b/tests/rep-add.test
@@ -24,7 +24,7 @@ rep_list += -d cfg
$clone_cfg;
$* '' 2>>EOE != 0
- error: empty repository location
+ error: invalid repository location '': empty URL
EOE
}