diff options
Diffstat (limited to 'src/watch/mirror.rs')
| -rw-r--r-- | src/watch/mirror.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/watch/mirror.rs b/src/watch/mirror.rs index 07a60c0..d7c793b 100644 --- a/src/watch/mirror.rs +++ b/src/watch/mirror.rs @@ -14,7 +14,21 @@ pub enum Sync { Cloned { head: String }, } +/// Detection calls it to move the mirror; the test that pins it drives a real sync. +/// +/// Module-internal in a production build, `pub` only under `test-support`: +/// one body behind two visibility declarations, exactly one of which compiles. +#[cfg(feature = "test-support")] pub fn sync_mirror(cfg: &Config, db: &Db, name: &str, url: &str) -> Result<Sync> { + sync_mirror_impl(cfg, db, name, url) +} + +#[cfg(not(feature = "test-support"))] +pub(crate) fn sync_mirror(cfg: &Config, db: &Db, name: &str, url: &str) -> Result<Sync> { + sync_mirror_impl(cfg, db, name, url) +} + +fn sync_mirror_impl(cfg: &Config, db: &Db, name: &str, url: &str) -> Result<Sync> { let mirror = cfg.mirror_path(name); let known_head = db::get_pkgbase(db, name)?.and_then(|p| p.aur_head.clone()); |
