Skip to main content

is_process_commit

Function is_process_commit 

Source
pub fn is_process_commit(message: &str) -> bool
Expand description

Returns true if the commit message looks like an automatically generated process commit — merge, revert, fixup, squash, or initial commit.

Detection is based on the first line (subject) of the message only, using well-known prefix patterns from GitHub, GitLab, Gerrit, and git itself. No git parent-count check is performed; this works across all input modes.

§Process commit patterns

PatternSource
Merge pull request #N …GitHub
Merge branch '…'GitHub/GitLab/git
Merge tag '…'git
Merge remote-tracking branch …git
Merge "…"Gerrit
Merge changes …Gerrit
Revert "…"git revert
fixup! …git commit --fixup
squash! …git commit --squash
Initial commitGitHub / convention

§Examples

use standard_commit::is_process_commit;

assert!(is_process_commit("Merge pull request #42 from owner/branch"));
assert!(is_process_commit("Revert \"feat: add login\""));
assert!(is_process_commit("fixup! fix: handle timeout"));
assert!(!is_process_commit("feat: add login"));
assert!(!is_process_commit("chore: update deps"));