diff options
author | Teddy Wing | 2021-05-29 17:25:43 +0200 |
---|---|---|
committer | Teddy Wing | 2021-05-29 17:25:43 +0200 |
commit | 9b6ecdd494443b8db6d037f550ca2744b3b85aad (patch) | |
tree | af7f25875c80811ad655cf2d198b5d128fdcd6ad /src/git.rs | |
parent | 8c233d6d29e15c260a2ffa46b747d870cebc80e6 (diff) | |
download | reflectub-9b6ecdd494443b8db6d037f550ca2744b3b85aad.tar.bz2 |
git::mirror(): Extract arguments
Move hard-coded repository values to function arguments.
Diffstat (limited to 'src/git.rs')
-rw-r--r-- | src/git.rs | 16 |
1 files changed, 6 insertions, 10 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/*", )?; |