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

Function classify_commit

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

Classify an imported commit as normal, merge, or squash.

(info: &ImportedCommitInfo)

Source from the content-addressed store, hash-verified

3904
3905/// Classify an imported commit as normal, merge, or squash.
3906fn classify_commit(info: &ImportedCommitInfo) -> CommitClassification {
3907 // 1. Multi-parent merge commits
3908 if info.is_merge {
3909 return CommitClassification::Merge;
3910 }
3911
3912 // 2. Atomic-Changes trailer (written by `atomic git push`)
3913 if let Some(hashes) = parse_atomic_changes_trailer(&info.message) {
3914 let pr = parse_pr_number(&info.message);
3915 return CommitClassification::Squash {
3916 original_hashes: hashes,
3917 pr_number: pr,
3918 };
3919 }
3920
3921 // 3. Squash merge format (GitHub, GitLab, Azure DevOps)
3922 if let Some(pr) = parse_squash_merge_format(&info.message) {
3923 return CommitClassification::Squash {
3924 original_hashes: Vec::new(),
3925 pr_number: Some(pr),
3926 };
3927 }
3928
3929 CommitClassification::Normal
3930}
3931
3932/// Split the value of a single `Atomic-Changes:` trailer (the text after the
3933/// colon) into individual, non-empty change hashes.

Calls 3

parse_pr_numberFunction · 0.85