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

Method write_commit

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

2898 /// Returns metadata about the imported commit for post-import
2899 /// classification and ReviewGate tagging.
2900 fn write_commit(
2901 &self,
2902 repo: &mut Repository,
2903 parsed: &ParsedCommit,
2904 line_index: &mut ImportLineIndex,
2905 ) -> CliResult<ImportedCommitInfo> {
2906 use atomic_core::output::memory::Memory;
2907 use atomic_core::record::workflow::{
2908 record_added_file, record_deleted_file, record_modified_file, DetectedFile,
2909 RecordedFile, RecordingOptions,
2910 };
2911
2912 let commit_start = std::time::Instant::now();
2913
2914 // Build change header
2915 let mut header_builder = ChangeHeader::builder()
2916 .message(&parsed.metadata.message)
2917 .author(Author::new(
2918 &parsed.metadata.author_name,
2919 parsed.metadata.author_email.as_deref(),
2920 ))
2921 .timestamp(parsed.metadata.timestamp);
2922
2923 if let Some(ref desc) = parsed.metadata.description {
2924 header_builder = header_builder.description(desc);
2925 }
2926
2927 let header = header_builder.build();
2928
2929 // Handle empty commits
2930 if parsed.is_empty {
2931 return self.write_empty_commit(repo, parsed, header);
2932 }
2933
2934 line_index.seed_missing_modified_files(repo, parsed);
2935 let graph_first_skips = build_graph_first_skip_reasons(parsed, line_index);
2936 let graph_first_result =
2937 build_graph_first_change(header.clone(), parsed, line_index, self.options.graph_only);
2938
2939 if let Ok((mut graph_change, pending_updates, graph_deleted_paths)) = graph_first_result {
2940 graph_change.unhashed = Some(self.build_git_metadata(parsed, false, false));
2941 let pre_write_shape = import_shape_summary(parsed, line_index);
2942 let pre_write_skip_summary = graph_first_skip_summary(&graph_first_skips, parsed);
2943 let progress = SlowImportProgress::start(
2944 slow_import_commit_label(parsed),
2945 if pre_write_shape.is_empty() && pre_write_skip_summary.is_empty() {
2946 format!(
2947 "graph-first files={}, ops={}; CRDT metadata deferred",
2948 parsed.files.len(),
2949 graph_change.hunks().len()
2950 )
2951 } else {
2952 format!(
2953 "graph-first files={}, ops={}; {}{}{}CRDT metadata deferred",
2954 parsed.files.len(),
2955 graph_change.hunks().len(),
2956 pre_write_shape,
2957 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