Delete a file from the filesystem.
(&self, repo_root: &std::path::Path, path: &str)
| 212 | |
| 213 | /// Delete a file from the filesystem. |
| 214 | fn delete_file(&self, repo_root: &std::path::Path, path: &str) -> std::io::Result<()> { |
| 215 | let full_path = repo_root.join(path); |
| 216 | if full_path.is_dir() { |
| 217 | std::fs::remove_dir_all(&full_path) |
| 218 | } else if full_path.exists() { |
| 219 | std::fs::remove_file(&full_path) |
| 220 | } else { |
| 221 | Ok(()) // Already doesn't exist |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | /// Whether an untracked staged path should also leave the working copy. |
| 226 | /// |