upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/test_utils/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-08-01 09:39:08 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-08-01 10:19:31 +0100
commitc494242fbf7308e50e38ed7b4750a4fe2638ed18 (patch)
tree506cbe2c95a1fc80902b665055dbeadebc644000 /test_utils/src
parent5c973c672f79510b19cd394a33751d93b7f9f5ee (diff)
feat(remote): `fetch` uses state event
and falls back to git server is state event cant be found
Diffstat (limited to 'test_utils/src')
-rw-r--r--test_utils/src/git.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/test_utils/src/git.rs b/test_utils/src/git.rs
index 7dfa62b..4a4aaa8 100644
--- a/test_utils/src/git.rs
+++ b/test_utils/src/git.rs
@@ -123,6 +123,15 @@ impl GitTestRepo {
123 }) 123 })
124 } 124 }
125 125
126 pub fn clone_repo(existing_repo: &GitTestRepo) -> Result<Self> {
127 let path = current_dir()?.join(format!("tmpgit-{}", rand::random::<u64>()));
128 let git_repo = git2::Repository::clone(existing_repo.dir.to_str().unwrap(), path.clone())?;
129 Ok(Self {
130 dir: path,
131 git_repo,
132 })
133 }
134
126 pub fn initial_commit(&self) -> Result<Oid> { 135 pub fn initial_commit(&self) -> Result<Oid> {
127 let oid = self.git_repo.index()?.write_tree()?; 136 let oid = self.git_repo.index()?.write_tree()?;
128 let tree = self.git_repo.find_tree(oid)?; 137 let tree = self.git_repo.find_tree(oid)?;