It is now case-insensitive, which prevents it from getting tripped up in some cases.
Unified · Split
| @@ -245,7 +245,14 @@ fn parse_conventional_to_next_section_title( · 244 unmodified lines | |||
| 245 | "fix", "add", "feat", "revert", "remove", "change", "docs", "perf", "refactor", "other", "style", | 245 | "fix", "add", "feat", "revert", "remove", "change", "docs", "perf", "refactor", "other", "style", |
| 246 | ] | 246 | ] |
| 247 | .iter() | 247 | .iter() |
| 248 | .find(|kind| title.starts_with(section::segment::conventional::as_headline(*kind).unwrap_or(*kind))) | 248 | .find(|kind| { |
| 249 | let headline = section::segment::conventional::as_headline(*kind).unwrap_or(*kind); | ||
| 250 | let common_len = headline.len().min(title.len()); | ||
| 251 | title | ||
| 252 | .get(..common_len) | ||
| 253 | .and_then(|t| headline.get(..common_len).map(|h| t.eq_ignore_ascii_case(h))) | ||
| 254 | .unwrap_or(false) | ||
| 255 | }) | ||
| 249 | .expect("BUG: this list needs an update too if new kinds of conventional messages are added"); | 256 | .expect("BUG: this list needs an update too if new kinds of conventional messages are added"); |
| 250 | 257 | ||
| 251 | let mut conventional = section::segment::Conventional { | 258 | let mut conventional = section::segment::Conventional { |
| @@ -37,6 +37,7 @@ pub mod conventional { · 36 unmodified lines | |||
| 37 | "chore" => "Chore", | 37 | "chore" => "Chore", |
| 38 | "test" => "Test", | 38 | "test" => "Test", |
| 39 | "refactor" => "Refactor", | 39 | "refactor" => "Refactor", |
| 40 | "other" => "Other", | ||
| 40 | "style" => "Style", | 41 | "style" => "Style", |
| 41 | _unknown => return None, | 42 | _unknown => return None, |
| 42 | }) | 43 | }) |