From 25776f714ed5a79d58aeebd902db870d178f8165 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 30 May 2021 15:45:13 +0200 Subject: Add repository description when mirroring Copy the repository description from GitHub into the clone repo. --- src/git.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/git.rs') diff --git a/src/git.rs b/src/git.rs index 017aae3..d83d2b6 100644 --- a/src/git.rs +++ b/src/git.rs @@ -11,8 +11,16 @@ use std::path::Path; pub fn mirror>( url: &str, path: P, + description: Option<&str>, ) -> Result<(), Box> { - 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"; -- cgit v1.2.3