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

Method seed_file_from_graph_content

atomic-cli/src/commands/git/parallel.rs:585–657  ·  view source on GitHub ↗
(
        &mut self,
        repo: &Repository,
        path: &str,
        content: &[u8],
        imported_commits_hint: usize,
    )

Source from the content-addressed store, hash-verified

583 }
584
585 fn seed_file_from_graph_content(
586 &mut self,
587 repo: &Repository,
588 path: &str,
589 content: &[u8],
590 imported_commits_hint: usize,
591 ) -> bool {
592 let line_contents: Vec<Vec<u8>> =
593 if Encoding::detect(content) == Encoding::Binary || is_generated_diff_skip_path(path) {
594 if content.is_empty() {
595 Vec::new()
596 } else {
597 vec![content.to_vec()]
598 }
599 } else {
600 split_graph_first_lines(content)
601 .into_iter()
602 .map(|line| line.to_vec())
603 .collect()
604 };
605
606 let seed = match repo.import_line_index_seed(path) {
607 Ok(Some(seed)) => seed,
608 Ok(None) => return false,
609 Err(err) => {
610 trace_git_import(format!(
611 "could not reseed line index for {} after fallback: {}",
612 path, err
613 ));
614 return false;
615 }
616 };
617
618 if seed.lines.len() != line_contents.len() {
619 trace_git_import(format!(
620 "not reseeding line index for {} after fallback: graph lines={} content lines={}",
621 path,
622 seed.lines.len(),
623 line_contents.len()
624 ));
625 return false;
626 }
627
628 let mut imported_changes = HashSet::new();
629 let lines = seed
630 .lines
631 .iter()
632 .zip(line_contents)
633 .map(|(line, content)| {
634 imported_changes.insert(line.incoming_by);
635 ImportLine {
636 change: line.change,
637 start: line.start,
638 end: line.end,
639 incoming_by: line.incoming_by,
640 content,
641 }
642 })

Callers 1

Calls 9

split_graph_first_linesFunction · 0.85
trace_git_importFunction · 0.85
is_emptyMethod · 0.45
into_iterMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected