diff options
| -rw-r--r-- | src/git.rs | 16 | ||||
| -rw-r--r-- | src/main.rs | 7 | 
2 files changed, 12 insertions, 11 deletions
| @@ -1,21 +1,17 @@  use std::path::Path; -pub fn mirror() -> Result<(), Box<dyn std::error::Error>> { -    // let builder = git2::build::RepoBuilder::new() -    //     .bare(true) -    //     .clone( -    //         "https://github.com/teddywing/google-calendar-rsvp.git", -    //         Path::new("/tmp/grsvp"), -    //     ); - -    let repo = git2::Repository::init_bare(Path::new("/tmp/grsvp"))?; +pub fn mirror<P: AsRef<Path>>( +    url: &str, +    path: P, +) -> Result<(), Box<dyn std::error::Error>> { +    let repo = git2::Repository::init_bare(path)?;      let remote_name = "origin";      let mut remote = repo.remote_with_fetch(          remote_name, -        "https://github.com/teddywing/google-calendar-rsvp.git", +        url,          "+refs/*:refs/*",      )?; diff --git a/src/main.rs b/src/main.rs index 994c86f..e31da8e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,15 @@  use reflectub::{git, github}; +use std::path::Path; +  fn main() {      // let repos = github::fetch_repos().unwrap();      //      // dbg!(&repos); -    git::mirror().unwrap(); +    git::mirror( +        "https://github.com/teddywing/google-calendar-rsvp.git", +        Path::new("/tmp/grsvp"), +    ).unwrap();  } | 
