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

Function classify_commit

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

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

(info: &ImportedCommitInfo)

Source from the content-addressed store, hash-verified

3534
3535/// Classify an imported commit as normal, merge, or squash.
3536fn classify_commit(info: &ImportedCommitInfo) -> CommitClassification {
3537 // 1. Multi-parent merge commits
3538 if info.is_merge {
3539 return CommitClassification::Merge;
3540 }
3541
3542 // 2. Atomic-Changes trailer (written by `atomic git push`)
3543 if let Some(hashes) = parse_atomic_changes_trailer(&info.message) {
3544 let pr = parse_pr_number(&info.message);
3545 return CommitClassification::Squash {
3546 original_hashes: hashes,
3547 pr_number: pr,
3548 };
3549 }
3550
3551 // 3. Squash merge format (GitHub, GitLab, Azure DevOps)
3552 if let Some(pr) = parse_squash_merge_format(&info.message) {
3553 return CommitClassification::Squash {
3554 original_hashes: Vec::new(),
3555 pr_number: Some(pr),
3556 };
3557 }
3558
3559 CommitClassification::Normal
3560}
3561
3562/// Parse "Atomic-Changes: HASH1, HASH2, ..." from a commit message.
3563fn parse_atomic_changes_trailer(message: &str) -> Option<Vec<String>> {

Calls 3

parse_pr_numberFunction · 0.85