1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use std::fs::create_dir_all; use std::path::PathBuf; use std::sync::Once; static INIT: Once = Once::new(); pub fn initialize() { INIT.call_once(|| { let repo_path = get_test_library_path().join(PathBuf::from("test/law-html")); let heads_path = repo_path.join(PathBuf::from("refs/heads")); create_dir_all(heads_path).unwrap(); let tags_path = repo_path.join(PathBuf::from("refs/tags")); create_dir_all(tags_path).unwrap(); }); } pub fn get_test_library_path() -> PathBuf { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); path.push("tests/fixtures/library"); path }