Implement util::mkrepo()

This commit is contained in:
Matthias Beyer 2016-05-15 00:35:09 +02:00
parent 8f8568a03a
commit 24e747029c

View file

@ -2,8 +2,20 @@
//! //!
//! Contains primitives to create a repository within the store path //! Contains primitives to create a repository within the store path
use git2::Repository;
use vcs::git::error::GitHookErrorKind as GHEK;
use vcs::git::error::MapErrInto;
pub fn mkrepo(store: &Store) -> Result<()> { pub fn mkrepo(store: &Store) -> Result<()> {
unimplemented!() let mut opts = RepositoryInitOptions::new();
opts.bare(false);
opts.no_reinit(true);
opts.mkdir(false);
opts.external_template(false);
Repository::init_opts(store.path(), &opts)
.map(|_| ())
.map_err_into(GHEK::MkRepo)
} }
pub fn hasrepo(store: &Store) -> bool { pub fn hasrepo(store: &Store) -> bool {