MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / seed_missing_modified_files

Method seed_missing_modified_files

atomic-cli/src/commands/git/parallel.rs:507–583  ·  view source on GitHub ↗
(&mut self, repo: &Repository, parsed: &ParsedCommit)

Source from the content-addressed store, hash-verified

505 }
506
507 fn seed_missing_modified_files(&mut self, repo: &Repository, parsed: &ParsedCommit) {
508 for file in &parsed.files {
509 if file.operation != FileOperation::Modified || self.files.contains_key(&file.path) {
510 continue;
511 }
512 let Some(old_content) = file.old_content.as_deref() else {
513 continue;
514 };
515
516 let old_lines: Vec<Vec<u8>> = if Encoding::detect(old_content) == Encoding::Binary
517 || is_generated_diff_skip_path(&file.path)
518 {
519 if old_content.is_empty() {
520 Vec::new()
521 } else {
522 vec![old_content.to_vec()]
523 }
524 } else {
525 split_graph_first_lines(old_content)
526 .into_iter()
527 .map(|line| line.to_vec())
528 .collect()
529 };
530
531 let seed = match repo.import_line_index_seed(&file.path) {
532 Ok(Some(seed)) => seed,
533 Ok(None) => continue,
534 Err(err) => {
535 trace_git_import(format!(
536 "{}: could not seed line index for {}: {}",
537 parsed.short_sha, file.path, err
538 ));
539 continue;
540 }
541 };
542
543 if seed.lines.len() != old_lines.len() {
544 trace_git_import(format!(
545 "{}: not seeding line index for {}: graph lines={} git old lines={}",
546 parsed.short_sha,
547 file.path,
548 seed.lines.len(),
549 old_lines.len()
550 ));
551 continue;
552 }
553
554 let mut imported_changes = HashSet::new();
555 let lines = seed
556 .lines
557 .iter()
558 .zip(old_lines)
559 .map(|(line, content)| {
560 imported_changes.insert(line.incoming_by);
561 ImportLine {
562 change: line.change,
563 start: line.start,
564 end: line.end,

Callers 1

write_commitMethod · 0.80

Calls 11

split_graph_first_linesFunction · 0.85
trace_git_importFunction · 0.85
contains_keyMethod · 0.80
is_emptyMethod · 0.45
into_iterMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected