| 1301 | #[test] |
| 1302 | #[file_serial] |
| 1303 | fn test_add_with_path_containing_spaces() { |
| 1304 | let _guard = DirGuard::new(); |
| 1305 | |
| 1306 | let temp_dir = tempfile::tempdir().unwrap(); |
| 1307 | let repo_path = temp_dir.path(); |
| 1308 | |
| 1309 | // Initialize repository |
| 1310 | { |
| 1311 | let _repo = Repository::init(repo_path).unwrap(); |
| 1312 | } |
| 1313 | |
| 1314 | // Create a file with spaces in name |
| 1315 | std::fs::write(repo_path.join("my file.txt"), "content").unwrap(); |
| 1316 | |
| 1317 | std::env::set_current_dir(repo_path).unwrap(); |
| 1318 | |
| 1319 | let add = Add::new().with_files(vec!["my file.txt"]); |
| 1320 | let result = add.run(); |
| 1321 | |
| 1322 | assert!( |
| 1323 | result.is_ok(), |
| 1324 | "Add file with spaces failed: {:?}", |
| 1325 | result.err() |
| 1326 | ); |
| 1327 | } |
| 1328 | |
| 1329 | #[test] |
| 1330 | #[file_serial] |