(output: &str)
| 304 | } |
| 305 | |
| 306 | fn parse_remote_name_status_output(output: &str) -> Vec<GitChangedFile> { |
| 307 | output |
| 308 | .lines() |
| 309 | .filter_map(|line| { |
| 310 | let mut parts = line.split('\t'); |
| 311 | let raw_status = parts.next()?.trim(); |
| 312 | if raw_status.is_empty() { |
| 313 | return None; |
| 314 | } |
| 315 | |
| 316 | let status = match raw_status.chars().next().unwrap_or_default() { |
| 317 | 'A' => GitChangedFileStatus::Added, |
| 318 | 'M' => GitChangedFileStatus::Modified, |
| 319 | 'D' => GitChangedFileStatus::Deleted, |
| 320 | 'R' => GitChangedFileStatus::Renamed, |
| 321 | 'C' => GitChangedFileStatus::Copied, |
| 322 | _ => GitChangedFileStatus::Unknown, |
| 323 | }; |
| 324 | |
| 325 | match status { |
| 326 | GitChangedFileStatus::Renamed | GitChangedFileStatus::Copied => { |
| 327 | let old_path = parts.next()?.to_string(); |
| 328 | let path = parts.next()?.to_string(); |
| 329 | Some(GitChangedFile { |
| 330 | path, |
| 331 | old_path: Some(old_path), |
| 332 | status, |
| 333 | }) |
| 334 | } |
| 335 | _ => { |
| 336 | let path = parts.next()?.to_string(); |
| 337 | Some(GitChangedFile { |
| 338 | path, |
| 339 | old_path: None, |
| 340 | status, |
| 341 | }) |
| 342 | } |
| 343 | } |
| 344 | }) |
| 345 | .collect() |
| 346 | } |
| 347 | |
| 348 | fn git_log_args(params: &GitLogParams) -> Vec<String> { |
| 349 | let mut args = vec![ |
no test coverage detected