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

Method write_commit

atomic-cli/src/commands/git/parallel.rs:2676–3286  ·  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

2674 /// Returns metadata about the imported commit for post-import
2675 /// classification and ReviewGate tagging.
2676 fn write_commit(
2677 &self,
2678 repo: &mut Repository,
2679 parsed: &ParsedCommit,
2680 line_index: &mut ImportLineIndex,
2681 ) -> CliResult<ImportedCommitInfo> {
2682 use atomic_core::output::memory::Memory;
2683 use atomic_core::record::workflow::{
2684 record_added_file, record_deleted_file, record_modified_file, DetectedFile,
2685 RecordedFile, RecordingOptions,
2686 };
2687
2688 let commit_start = std::time::Instant::now();
2689
2690 // Build change header
2691 let mut header_builder = ChangeHeader::builder()
2692 .message(&parsed.metadata.message)
2693 .author(Author::new(
2694 &parsed.metadata.author_name,
2695 parsed.metadata.author_email.as_deref(),
2696 ))
2697 .timestamp(parsed.metadata.timestamp);
2698
2699 if let Some(ref desc) = parsed.metadata.description {
2700 header_builder = header_builder.description(desc);
2701 }
2702
2703 let header = header_builder.build();
2704
2705 // Handle empty commits
2706 if parsed.is_empty {
2707 return self.write_empty_commit(repo, parsed, header);
2708 }
2709
2710 line_index.seed_missing_modified_files(repo, parsed);
2711 let graph_first_skips = build_graph_first_skip_reasons(parsed, line_index);
2712 let graph_first_result =
2713 build_graph_first_change(header.clone(), parsed, line_index, self.options.graph_only);
2714
2715 if let Ok((mut graph_change, pending_updates, graph_deleted_paths)) = graph_first_result {
2716 graph_change.unhashed = Some(self.build_git_metadata(parsed, false, false));
2717 let pre_write_shape = import_shape_summary(parsed, line_index);
2718 let pre_write_skip_summary = graph_first_skip_summary(&graph_first_skips, parsed);
2719 let progress = SlowImportProgress::start(
2720 slow_import_commit_label(parsed),
2721 if pre_write_shape.is_empty() && pre_write_skip_summary.is_empty() {
2722 format!(
2723 "graph-first files={}, ops={}; CRDT metadata deferred",
2724 parsed.files.len(),
2725 graph_change.hunks().len()
2726 )
2727 } else {
2728 format!(
2729 "graph-first files={}, ops={}; {}{}{}CRDT metadata deferred",
2730 parsed.files.len(),
2731 graph_change.hunks().len(),
2732 pre_write_shape,
2733 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