aboutsummaryrefslogtreecommitdiffstats
path: root/src/git.rs
diff options
context:
space:
mode:
authorTeddy Wing2021-05-30 16:44:57 +0200
committerTeddy Wing2021-05-30 16:44:57 +0200
commitee32b6e25cf042892867ae21bb72095cfda8be9c (patch)
tree950b61a85f4353c298112fef80f0bf63d9aa30fc /src/git.rs
parent4860cd1b0a0390c97d383568fd278b0778872b6f (diff)
downloadreflectub-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/git.rs')
-rw-r--r--src/git.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/git.rs b/src/git.rs
index 7ad919f..479a3c5 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -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";