Skip to main content

clean_message

Function clean_message 

Source
pub fn clean_message(raw: Option<&str>, path: &str) -> String
Expand description

The commit message for an edit: control-character runs become one space, the result is trimmed and cut to EDIT_MSG_CAP characters (never inside a UTF-8 sequence), and an empty result becomes web edit: <path>.

ยงExamples

use solid_pod_rs_forge::web_edit::clean_message;

assert_eq!(clean_message(Some("a\0\0b"), "p"), "a b");
assert_eq!(clean_message(Some("   "), "p"), "web edit: p");
assert_eq!(clean_message(Some(&"x".repeat(5000)), "p").chars().count(), 1000);