pub fn merge_wrap(text: &str) -> StringExpand description
The text as the squash merge of GitHub leaves it: a line of
MERGE_WIDTH characters or fewer stays as it is. A longer line loses
its indent and its double spaces, and is filled again with whole words
up to MERGE_WIDTH characters. The wrapped lines have no indent, and
the next line does not join them. A word longer than the width stays on
a line of its own.
So a trailer line over the width is no trailer line in the commit: the
second line of it has no Key:, and it ends the block of trailers
(trailer-wrap, 01M6FYR8XH4WPAH2AFW6B0NARJ).
let line = "Generated-by: GLM-5.3-Flash (brief, implementation, task review, final review)";
assert_eq!(
hygiene::merge_wrap(line),
"Generated-by: GLM-5.3-Flash (brief, implementation, task review, final\nreview)"
);
// A line of 72 characters stays. The next line stays too.
let kept = format!("{}\n indent\n", "word ".repeat(14) + "wo");
assert_eq!(hygiene::merge_wrap(&kept), kept);
// A long line with an indent loses it.
let item = " ".to_owned() + &"word ".repeat(15);
assert!(!hygiene::merge_wrap(&item).starts_with(' '));