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

Method write_commit

atomic-cli/src/commands/git/parallel.rs:2595–3205  ·  view source on GitHub ↗

Write a single commit to the repository. Returns metadata about the imported commit for post-import classification and ReviewGate tagging.

(
        &self,
        repo: &mut Repository,
        parsed: &ParsedCommit,
        line_index: &mut ImportLineIndex,
    )

Source from the content-addressed store, hash-verified

2593 /// Returns metadata about the imported commit for post-import
2594 /// classification and ReviewGate tagging.
2595 fn write_commit(
2596 &self,
2597 repo: &mut Repository,
2598 parsed: &ParsedCommit,
2599 line_index: &mut ImportLineIndex,
2600 ) -> CliResult<ImportedCommitInfo> {
2601 use atomic_core::output::memory::Memory;
2602 use atomic_core::record::workflow::{
2603 record_added_file, record_deleted_file, record_modified_file, DetectedFile,
2604 RecordedFile, RecordingOptions,
2605 };
2606
2607 let commit_start = std::time::Instant::now();
2608
2609 // Build change header
2610 let mut header_builder = ChangeHeader::builder()
2611 .message(&parsed.metadata.message)
2612 .author(Author::new(
2613 &parsed.metadata.author_name,
2614 parsed.metadata.author_email.as_deref(),
2615 ))
2616 .timestamp(parsed.metadata.timestamp);
2617
2618 if let Some(ref desc) = parsed.metadata.description {
2619 header_builder = header_builder.description(desc);
2620 }
2621
2622 let header = header_builder.build();
2623
2624 // Handle empty commits
2625 if parsed.is_empty {
2626 return self.write_empty_commit(repo, parsed, header);
2627 }
2628
2629 line_index.seed_missing_modified_files(repo, parsed);
2630 let graph_first_skips = build_graph_first_skip_reasons(parsed, line_index);
2631 let graph_first_result =
2632 build_graph_first_change(header.clone(), parsed, line_index, self.options.graph_only);
2633
2634 if let Ok((mut graph_change, pending_updates, graph_deleted_paths)) = graph_first_result {
2635 graph_change.unhashed = Some(self.build_git_metadata(parsed, false, false));
2636 let pre_write_shape = import_shape_summary(parsed, line_index);
2637 let pre_write_skip_summary = graph_first_skip_summary(&graph_first_skips, parsed);
2638 let progress = SlowImportProgress::start(
2639 slow_import_commit_label(parsed),
2640 if pre_write_shape.is_empty() && pre_write_skip_summary.is_empty() {
2641 format!(
2642 "graph-first files={}, ops={}; CRDT metadata deferred",
2643 parsed.files.len(),
2644 graph_change.hunks().len()
2645 )
2646 } else {
2647 format!(
2648 "graph-first files={}, ops={}; {}{}{}CRDT metadata deferred",
2649 parsed.files.len(),
2650 graph_change.hunks().len(),
2651 pre_write_shape,
2652 if pre_write_shape.is_empty() || pre_write_skip_summary.is_empty() {

Callers 1

phase2_writeMethod · 0.80

Calls 15

build_graph_first_changeFunction · 0.85
import_shape_summaryFunction · 0.85
graph_first_skip_summaryFunction · 0.85
slow_import_commit_labelFunction · 0.85
apply_line_index_updatesFunction · 0.85
print_infoFunction · 0.85
trace_git_importFunction · 0.85
record_git_diff_add_fastFunction · 0.85
addedFunction · 0.85
record_added_fileFunction · 0.85

Tested by

no test coverage detected