about summary refs log tree commit diff
path: root/src/actions/create.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/create.rs')
-rw-r--r--src/actions/create.rs12
1 files changed, 8 insertions, 4 deletions
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)?;