Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Allow `init` without running node
Alexis Sellier committed 3 years ago
commit c8c44c884cd58c1eff7597d02f1ccf36f70cddf3
parent e69be6051d9178a2a626f02e04e13f21114178d0
2 files changed +13 -4
modified radicle-cli/src/commands/init.rs
@@ -210,7 +210,7 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()>
        Ok((id, doc, _)) => {
            let proj = doc.project()?;

-
            if options.track {
+
            if options.track && node.is_running() {
                // It's important to track our own repositories to make sure that our node signals
                // interest for them. This ensures that messages relating to them are relayed to us.
                node.track_repo(id)?;
modified radicle-node/src/service.rs
@@ -359,9 +359,18 @@ where
        for (id, addr) in addrs {
            self.connect(id, addr);
        }
-
        // Ensure that our inventory is recorded in our routing table.
-
        for id in self.storage.inventory()? {
-
            self.routing.insert(id, self.node_id(), time.as_millis())?;
+
        // Ensure that our inventory is recorded in our routing table, and we are tracking
+
        // all of it. It can happen that inventory is not properly tracked if for eg. the
+
        // user creates a new repository while the node is stopped.
+
        for rid in self.storage.inventory()? {
+
            self.routing.insert(rid, self.node_id(), time.as_millis())?;
+

+
            if self
+
                .track_repo(&rid, tracking::Scope::All)
+
                .expect("Service::command: error tracking repository")
+
            {
+
                info!(target: "service", "Tracking local repository {rid}");
+
            }
        }
        // Setup subscription filter for tracked repos.
        self.filter = Filter::new(