From 7bb44980ced46506c10bad333f526b7bc62ea1db Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 3 Sep 2021 18:24:08 +0300 Subject: Add support for multiple temporary directories --- bpkg/rep-info.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'bpkg/rep-info.cxx') 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) ? ¤t_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 */)); -- cgit v1.1