diff --git a/src/functions/add.rs b/src/functions/add.rs index 2ff8e45..e2df0c2 100644 --- a/src/functions/add.rs +++ b/src/functions/add.rs @@ -40,13 +40,16 @@ pub fn add(files: &Vec, repo: Option<&Repository>) -> Result<(), Error> Err(e) => return Err(e), }; - let corrected_files: Vec = files - .iter() - .map(|f| { - f.strip_prefix(".\\").unwrap_or(f) - .to_string() - }) - .collect(); + let corrected_files: Vec = if files[0] == "." { + vec![files[0].to_string()] + } else { + files.iter() + .map(|f| { + f.strip_prefix(".\\").unwrap_or(f) + .to_string() + }) + .collect() + }; index.add_all(corrected_files, git2::IndexAddOption::DEFAULT, None).expect("Error while adding all files"); @@ -76,7 +79,7 @@ mod tests { add(&files, Some(repo)).unwrap(); - // check index contains dummy.txt + // check if the index contains dummy.txt let index = repo.index().unwrap(); assert!(index.get_path(Path::new("dummy.txt"), 0).is_some()); } diff --git a/src/functions/commit.rs b/src/functions/commit.rs index 13fb4cf..69c63ac 100644 --- a/src/functions/commit.rs +++ b/src/functions/commit.rs @@ -20,7 +20,7 @@ fn user_input(message: String) -> String { fn select_emoji() -> Result { let options = vec![ "🎨 :art: Improve structure/format", - "⚡ :zap: Improve performance", + "⚡ :zap: Improve performance", "🔥 :fire: Remove code or files", "🐛 :bug: Fix a bug", "🚑️ :ambulance: Critical hotfix",