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

Function classify_commit

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

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

(info: &ImportedCommitInfo)

Source from the content-addressed store, hash-verified

8407
8408/// Classify an imported commit as normal, merge, or squash.
8409fn classify_commit(info: &ImportedCommitInfo) -> CommitClassification {
8410 // 1. Multi-parent merge commits
8411 if info.is_merge {
8412 return CommitClassification::Merge;
8413 }
8414
8415 // 2. Atomic-Changes trailer (written by `atomic git push`)
8416 if let Some(hashes) = parse_atomic_changes_trailer(&info.message) {
8417 let pr = parse_pr_number(&info.message);
8418 return CommitClassification::Squash {
8419 original_hashes: hashes,
8420 pr_number: pr,
8421 };
8422 }
8423
8424 // 3. Squash merge format (GitHub, GitLab, Azure DevOps)
8425 if let Some(pr) = parse_squash_merge_format(&info.message) {
8426 return CommitClassification::Squash {
8427 original_hashes: Vec::new(),
8428 pr_number: Some(pr),
8429 };
8430 }
8431
8432 CommitClassification::Normal
8433}
8434
8435/// Split the value of a single `Atomic-Changes:` trailer (the text after the
8436/// colon) into individual, non-empty change hashes.

Calls 3

parse_pr_numberFunction · 0.85