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

Method write_commit

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

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