From e87af868dba6293c52eabd01a0b34cdafb4d34db Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 5 May 2026 11:47:21 +0100 Subject: [PATCH] node/test: `NodeHandle::commit_to` should namespace The `commit_to` method should namespace the reference, so that node is only ever committing the namespace of that particular node. This prevents the node from committing to another node's namespace or the canonical namespace. --- crates/radicle-node/src/test/node.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/radicle-node/src/test/node.rs b/crates/radicle-node/src/test/node.rs index 8cc216d2..dacc988c 100644 --- a/crates/radicle-node/src/test/node.rs +++ b/crates/radicle-node/src/test/node.rs @@ -365,8 +365,8 @@ impl + cyphernet::Ecdh> NodeHandle { *issues.create(title, desc, &[], &[], []).unwrap().id() } - /// Perform a commit to `refname` by generating a blob of random data to a - /// random path in a new tree. + /// Perform a commit to `refname`, within the node's namespace, by + /// generating a blob of random data to a random path in a new tree. /// /// If the reference does not exist, a new one will be created with the new /// commit as its target. @@ -378,7 +378,12 @@ impl + cyphernet::Ecdh> NodeHandle { pub fn commit_to(&self, rid: RepoId, refname: impl AsRef) { use radicle::test::arbitrary; - let refname = refname.as_ref(); + let refname = match git::fmt::Qualified::from_refstr(refname.as_ref()) { + None => git::fmt::lit::refs_heads(refname).into(), + Some(refname) => refname, + }; + let refname = refname.with_namespace(self.id.to_component()); + let repo = self.storage.repository(rid).unwrap(); let raw = &repo.backend;