pub struct GitTestament<'a> {
    pub commit: CommitKind<'a>,
    pub modifications: &'a [GitModification<'a>],
    pub branch_name: Option<&'a str>,
}
Expand description

A testament to the state of a git repository when a crate is built.

This is the type returned by the git_testament_derive::git_testament macro when used to record the state of a git tree when a crate is built.

The structure contains information about the commit from which the crate was built, along with information about any modifications to the working tree which could be considered “dirty” as a result.

By default, the Display implementation for this structure attempts to produce something pleasant but useful to humans. For example it might produce a string along the lines of "1.0.0 (763aa159d 2019-04-02)" for a clean build from a 1.0.0 tag. Alternatively if the working tree is dirty and there have been some commits since the last tag, you might get something more like "1.0.0+14 (651af89ed 2019-04-02) dirty 4 modifications"

If your program wishes to go into more detail, then the commit and the modifications members are available for rendering as the program author sees fit.

In general this is only of use for binaries, since libraries will generally be built from crates.io provided tarballs and as such won’t carry the information needed. In such a fallback position the string will be something along the lines of "x.y (somedate)" where x.y is the crate’s version and somedate is the date of the build. You’ll get similar information if the crate is built in a git repository on a branch with no commits yet (e.g. when you first have run cargo init) though that will include the string uncommitted to indicate that once commits are made the information will be of more use.

Fields§

§commit: CommitKind<'a>§modifications: &'a [GitModification<'a>]§branch_name: Option<&'a str>

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.