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

Function parse_header_trailer

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

Read one `Key: value` identity header from a commit message (the record-projection header format; RFC §8.2).

(message: &str, key: &str)

Source from the content-addressed store, hash-verified

8479/// Read one `Key: value` identity header from a commit message (the
8480/// record-projection header format; RFC §8.2).
8481fn parse_header_trailer(message: &str, key: &str) -> Option<String> {
8482 let prefix = format!("{key}:");
8483 for line in message.lines() {
8484 let line = line.trim();
8485 if let Some(rest) = line.strip_prefix(&prefix) {
8486 let value = rest.trim();
8487 if !value.is_empty() {
8488 return Some(value.to_string());
8489 }
8490 }
8491 }
8492 None
8493}
8494
8495/// Parse a PR/MR number from a commit message.
8496///

Callers 2

resolve_view_claimMethod · 0.85

Calls 2

linesMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected