aboutsummaryrefslogtreecommitdiff
path: root/bpkg/rep-info.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-09-03 18:24:08 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-09-04 12:40:57 +0300
commit7bb44980ced46506c10bad333f526b7bc62ea1db (patch)
tree207a14ee727f7237e8fc2b08e47f4de8a97e0b99 /bpkg/rep-info.cxx
parentbd02eaa1298271ecf8365aa869e93fdcb04fdeb1 (diff)
Add support for multiple temporary directories
Diffstat (limited to 'bpkg/rep-info.cxx')
-rw-r--r--bpkg/rep-info.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/bpkg/rep-info.cxx b/bpkg/rep-info.cxx
index c935114..4e3315b 100644
--- a/bpkg/rep-info.cxx
+++ b/bpkg/rep-info.cxx
@@ -49,9 +49,24 @@ namespace bpkg
// unknown manifest entries unless we are dumping them.
//
dir_path d (o.directory ());
+
+ const dir_path* conf (o.directory_specified () && d.empty ()
+ ? nullptr
+ : &d);
+
+ // If --directory|-d is not specified and the current working directory is
+ // a configuration directory, then initialize the temporary directory
+ // inside it, so that we can always move a version control-based
+ // repository into and out of it (see pkg_checkout() for details).
+ //
+ if (conf != nullptr && conf->empty ())
+ conf = exists (bpkg_dir) ? &current_dir : nullptr;
+
+ init_tmp (conf != nullptr ? *conf : empty_dir_path);
+
rep_fetch_data rfd (
rep_fetch (o,
- o.directory_specified () && d.empty () ? nullptr : &d,
+ conf,
rl,
!o.manifest () /* ignore_unknow */,
o.deep () /* expand_values */));