diff options
| author | Mel <einebeere@gmail.com> | 2021-10-01 00:34:16 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-10-01 00:34:16 +0200 |
| commit | 3f5c5026909af023c8a3885a4a3d97c669302c1b (patch) | |
| tree | 44c7e3e81d3b71ad6977afe4ac1596033b5834a6 /src/actions/create.rs | |
| parent | 8f700551fd3f98c7b9846af647a7318c171152a6 (diff) | |
| download | ka-3f5c5026909af023c8a3885a4a3d97c669302c1b.tar.zst ka-3f5c5026909af023c8a3885a4a3d97c669302c1b.zip | |
Global repository cursor
Diffstat (limited to 'src/actions/create.rs')
| -rw-r--r-- | src/actions/create.rs | 12 |
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)?; |
