input paths normalised before comparison

This commit is contained in:
2026-03-07 14:49:02 +00:00
parent 1eda5a9642
commit aafc847d02

View File

@@ -32,11 +32,12 @@ pub fn add(files: Vec<PathBuf>) -> Result<(), TourError> {
.open(STAGED_PATH)?; .open(STAGED_PATH)?;
for file in &files { for file in &files {
if existing_set.contains(file) { let normalized: PathBuf = file.components().collect();
println!("already staged: {}", file.display()); if existing_set.contains(&normalized) {
println!("already staged: {}", normalized.display());
} else { } else {
writeln!(staged, "{}", file.display())?; writeln!(staged, "{}", normalized.display())?;
println!("staged: {}", file.display()); println!("staged: {}", normalized.display());
} }
} }