diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-02-17 16:04:58 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-02-19 14:28:57 +0300 |
commit | 11dfd8bc4022b6596c2158594f18544a1f7ffa3e (patch) | |
tree | 0b88ccc3b977d43a40fb0937d6d34fedcb05a927 /bpkg/rep-fetch.cxx | |
parent | 3d4838d3706de2ba0045dc9f99a3dc96398def64 (diff) |
Use root repository as a default complement for git repository
Diffstat (limited to 'bpkg/rep-fetch.cxx')
-rw-r--r-- | bpkg/rep-fetch.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index 029db1d..e78ae064 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -367,6 +367,7 @@ namespace bpkg case repository_type::git: return rep_fetch_git (co, conf, rl, iu); } + assert (false); // Can't be here. return rep_fetch_data (); } @@ -500,6 +501,19 @@ namespace bpkg } } + // For git repositories that have neither prerequisites nor complements + // we use the root repository as the default complement. + // + // This supports the common use case where the user has a single-package + // git repository and doesn't want to bother with the repositories file. + // This way their package will still pick up its dependencies from the + // configuration, without regards from which repositories they came from. + // + if (rl.type () == repository_type::git && + r->complements.empty () && + r->prerequisites.empty ()) + r->complements.insert (lazy_shared_ptr<repository> (db, root)); + // "Suspend" session while persisting packages to reduce memory // consumption. // |