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:2373–2461  ·  view source on GitHub ↗
(&mut self, repo: &Repository, parsed: &ParsedCommit)

Source from the content-addressed store, hash-verified

2371 }
2372
2373 fn seed_missing_modified_files(&mut self, repo: &Repository, parsed: &ParsedCommit) {
2374 for file in &parsed.files {
2375 if file.operation != FileOperation::Modified || self.files.contains_key(&file.path) {
2376 continue;
2377 }
2378 let Some(old_content) = file.old_content.as_deref() else {
2379 continue;
2380 };
2381
2382 let old_lines: Vec<Vec<u8>> = if Encoding::detect(old_content) == Encoding::Binary
2383 || is_generated_diff_skip_path(&file.path)
2384 {
2385 if old_content.is_empty() {
2386 Vec::new()
2387 } else {
2388 vec![old_content.to_vec()]
2389 }
2390 } else {
2391 split_graph_first_lines(old_content)
2392 .into_iter()
2393 .map(|line| line.to_vec())
2394 .collect()
2395 };
2396
2397 let seed = match repo.import_line_index_seed(&repository_path(&file.path)) {
2398 Ok(Some(seed)) => seed,
2399 Ok(None) => continue,
2400 Err(err) => {
2401 trace_git_import(format!(
2402 "{}: could not seed line index for {}: {}",
2403 parsed.short_sha, file.path, err
2404 ));
2405 continue;
2406 }
2407 };
2408
2409 if seed.lines.len() != old_lines.len() {
2410 trace_git_import(format!(
2411 "{}: not seeding line index for {}: graph lines={} git old lines={}",
2412 parsed.short_sha,
2413 file.path,
2414 seed.lines.len(),
2415 old_lines.len()
2416 ));
2417 continue;
2418 }
2419
2420 let mut imported_changes = HashSet::new();
2421 let lines = seed
2422 .lines
2423 .iter()
2424 .zip(old_lines)
2425 .enumerate()
2426 .map(|(index, (line, content))| {
2427 imported_changes.insert(line.incoming_by);
2428 ImportLine {
2429 change: line.change,
2430 start: line.start,

Callers

nothing calls this directly

Calls 13

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

Tested by

no test coverage detected