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

Function classify_commit

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

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

(info: &ImportedCommitInfo)

Source from the content-addressed store, hash-verified

3564
3565/// Classify an imported commit as normal, merge, or squash.
3566fn classify_commit(info: &ImportedCommitInfo) -> CommitClassification {
3567 // 1. Multi-parent merge commits
3568 if info.is_merge {
3569 return CommitClassification::Merge;
3570 }
3571
3572 // 2. Atomic-Changes trailer (written by `atomic git push`)
3573 if let Some(hashes) = parse_atomic_changes_trailer(&info.message) {
3574 let pr = parse_pr_number(&info.message);
3575 return CommitClassification::Squash {
3576 original_hashes: hashes,
3577 pr_number: pr,
3578 };
3579 }
3580
3581 // 3. Squash merge format (GitHub, GitLab, Azure DevOps)
3582 if let Some(pr) = parse_squash_merge_format(&info.message) {
3583 return CommitClassification::Squash {
3584 original_hashes: Vec::new(),
3585 pr_number: Some(pr),
3586 };
3587 }
3588
3589 CommitClassification::Normal
3590}
3591
3592/// Parse "Atomic-Changes: HASH1, HASH2, ..." from a commit message.
3593fn parse_atomic_changes_trailer(message: &str) -> Option<Vec<String>> {

Calls 3

parse_pr_numberFunction · 0.85