Macro git_testament::render_testament
source · macro_rules! render_testament { ( $testament:expr ) => { ... }; ( $testament:expr, $trusted_branch:expr ) => { ... }; }
Expand description
Render a testament
This macro can be used to render a testament created with the git_testament
macro. It renders a testament with the added benefit of indicating if the
tag does not match the version (by substring) then the crate’s version and
the tag will be displayed in the form: “crate-ver :: testament…”
For situations where the crate version MUST override the tag, for example
if you have a release process where you do not make the tag unless the CI
constructing the release artifacts passes, then you can pass a second
argument to this macro stating a branch name to trust. If the working
tree is clean and the branch name matches then the testament is rendered
as though the tag had been pushed at the built commit. Since this overrides
a fundamental part of the behaviour of git_testament
it is recommended that
this ONLY be used if you have a trusted CI release branch process.
use git_testament::{git_testament, render_testament};
git_testament!(TESTAMENT);
println!("The testament is: {}", render_testament!(TESTAMENT));
println!("The fiddled testament is: {}", render_testament!(TESTAMENT, "trusted-branch"));