Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/functions/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ pub fn add(files: &Vec<String>, repo: Option<&Repository>) -> Result<(), Error>
Err(e) => return Err(e),
};

let corrected_files: Vec<String> = files
.iter()
.map(|f| {
f.strip_prefix(".\\").unwrap_or(f)
.to_string()
})
.collect();
let corrected_files: Vec<String> = 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");

Expand Down Expand Up @@ -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());
}
Expand Down
2 changes: 1 addition & 1 deletion src/functions/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn user_input(message: String) -> String {
fn select_emoji() -> Result<String, InquireError> {
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",
Expand Down