Skip to main content

references

Function references 

Source
pub fn references(text: &str, objects: &[Object]) -> Vec<Reference>
Expand description

The records a commit’s own text names, resolved against what the layer holds.

The reference is inferred from the text — I1305, M000 — and then looked up. An id that matches the shape but names nothing is dropped, so this can never produce a link to a record that does not exist. The scan is over the subject and the body together, because a commit that explains itself in its body is the one most worth linking.

use majordomus_cli::release::commits::references;
// the shape alone is not a reference: against a layer that holds nothing, nothing resolves
assert!(references("fix(link): resolves I4242 and mentions M000", &[]).is_empty());
// and a word that merely starts with the letter is never a candidate
assert!(references("Interesting: M1 and I12345 are not ids", &[]).is_empty());