MCPcopy Create free account
hub / github.com/GCWing/BitFun / parse_remote_name_status_output

Function parse_remote_name_status_output

src/apps/desktop/src/api/git_api.rs:306–346  ·  view source on GitHub ↗
(output: &str)

Source from the content-addressed store, hash-verified

304}
305
306fn 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
348fn git_log_args(params: &GitLogParams) -> Vec<String> {
349 let mut args = vec![

Callers 1

git_get_changed_filesFunction · 0.85

Calls 4

collectMethod · 0.80
trimMethod · 0.80
nextMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected