diff options
| author | Teddy Wing | 2021-05-30 15:45:13 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2021-05-30 15:45:13 +0200 | 
| commit | 25776f714ed5a79d58aeebd902db870d178f8165 (patch) | |
| tree | dcc97b765f17aa6dcde23a780f72173101ea6a8e /src/git.rs | |
| parent | 80a1cda7f857dbb2e776253225446351228072fb (diff) | |
| download | reflectub-25776f714ed5a79d58aeebd902db870d178f8165.tar.bz2 | |
Add repository description when mirroring
Copy the repository description from GitHub into the clone repo.
Diffstat (limited to 'src/git.rs')
| -rw-r--r-- | src/git.rs | 10 | 
1 files changed, 9 insertions, 1 deletions
| @@ -11,8 +11,16 @@ use std::path::Path;  pub fn mirror<P: AsRef<Path>>(      url: &str,      path: P, +    description: Option<&str>,  ) -> Result<(), Box<dyn std::error::Error>> { -    let repo = git2::Repository::init_bare(path)?; +    let mut repo_init_options = git2::RepositoryInitOptions::new(); +    repo_init_options.bare(true); + +    if let Some(d) = description { +        repo_init_options.description(d); +    } + +    let repo = git2::Repository::init_opts(path, &repo_init_options)?;      let remote_name = "origin"; | 
