From 8336fe72ab8b4a93c54ca775ca88c567cc91c82c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 12 Jun 2023 15:06:00 +0200 Subject: Check for configuration name/id/path clash before creating/wiping it (GH issue #241) --- bdep/config.hxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bdep/config.hxx') diff --git a/bdep/config.hxx b/bdep/config.hxx index 3c66b72..2b4788a 100644 --- a/bdep/config.hxx +++ b/bdep/config.hxx @@ -15,7 +15,9 @@ namespace bdep // If type is nullopt, then assume that an existing configuration is being // added. If that's the case, query the bpkg configuration type and links // and warn the user if any host or build2 configurations are linked, unless - // they are already associated with the project. + // they are already associated with the project. If dry_run is true, then + // make sure the configuration can be added without path/name/id clash but + // don't actually add anything, returning NULL. // shared_ptr cmd_config_add (const common_options&, @@ -27,7 +29,8 @@ namespace bdep optional name, optional type, optional id = nullopt, - const char* what = "added"); + const char* what = "added", + bool dry_run = false); // Configuration directory should exist and its path should be absolute and // normalized. @@ -41,7 +44,8 @@ namespace bdep bool default_ = true, bool forward = true, bool auto_sync = true, - optional id = nullopt); + optional id = nullopt, + bool dry_run = false); void cmd_config_add_print (diag_record&, -- cgit v1.1