diff options
author | Teddy Wing | 2021-05-30 16:44:57 +0200 |
---|---|---|
committer | Teddy Wing | 2021-05-30 16:44:57 +0200 |
commit | ee32b6e25cf042892867ae21bb72095cfda8be9c (patch) | |
tree | 950b61a85f4353c298112fef80f0bf63d9aa30fc /src | |
parent | 4860cd1b0a0390c97d383568fd278b0778872b6f (diff) | |
download | reflectub-ee32b6e25cf042892867ae21bb72095cfda8be9c.tar.bz2 |
git::mirror(): Write empty description if `description` is `None`
This gets rid of the default description string:
Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'src')
-rw-r--r-- | src/git.rs | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -22,14 +22,17 @@ pub fn mirror<P: AsRef<Path>>( path: P, description: Option<&str>, ) -> Result<(), Error> { - 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 description_str = match description { + Some(d) => d, + None => "", + }; + + let repo = git2::Repository::init_opts( + path, + &git2::RepositoryInitOptions::new() + .bare(true) + .description(description_str), + )?; let remote_name = "origin"; |