From 3f5c5026909af023c8a3885a4a3d97c669302c1b Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 1 Oct 2021 00:34:16 +0200 Subject: Global repository cursor --- src/actions/create.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/actions/create.rs') diff --git a/src/actions/create.rs b/src/actions/create.rs index f00e95d..472cbe3 100644 --- a/src/actions/create.rs +++ b/src/actions/create.rs @@ -1,8 +1,8 @@ -use std::fs; +use std::fs::{self, File}; use anyhow::Result; -use crate::{actions::update, files::Locations}; +use crate::{actions::update, files::Locations, history::RepositoryHistory}; use super::ActionOptions; @@ -13,8 +13,12 @@ pub fn create(command_options: ActionOptions) -> Result<()> { fs::remove_dir_all(locations.ka_path.as_path())?; } - fs::create_dir(locations.ka_path)?; - fs::create_dir(locations.ka_files_path)?; + fs::create_dir(&locations.ka_path)?; + fs::create_dir(&locations.ka_files_path)?; + + let mut index_file = File::create(locations.get_repository_index())?; + let empty_history = RepositoryHistory::default(); + empty_history.write_to_file(&mut index_file)?; update(command_options)?; -- cgit 1.4.1