From c494242fbf7308e50e38ed7b4750a4fe2638ed18 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 1 Aug 2024 09:39:08 +0100 Subject: feat(remote): `fetch` uses state event and falls back to git server is state event cant be found --- test_utils/src/git.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test_utils/src') 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 { }) } + pub fn clone_repo(existing_repo: &GitTestRepo) -> Result { + let path = current_dir()?.join(format!("tmpgit-{}", rand::random::())); + let git_repo = git2::Repository::clone(existing_repo.dir.to_str().unwrap(), path.clone())?; + Ok(Self { + dir: path, + git_repo, + }) + } + pub fn initial_commit(&self) -> Result { let oid = self.git_repo.index()?.write_tree()?; let tree = self.git_repo.find_tree(oid)?; -- cgit v1.2.3