Function grev::get_revision
source · pub fn get_revision<P, W>(directory: P, writer: W) -> Result<Option<String>>where
P: AsRef<Path>,
W: Write,
👎Deprecated: use git_revision() function instead
Expand description
Retrieve a git revision identifier that either includes the tag we
are on or the shortened SHA-1. It also contains an indication (+
)
whether local changes were present.
This function is meant to be run from a Cargo build script. It takes
care of printing necessary rerun-if-changed
directives to the
provided writer. As a result, callers are advised to invoke it only
once and cache the result.
The provided directory
is a path expected to point somewhere into
the git repository in question. Typically, it can simply be set to
the value of the CARGO_MANIFEST_DIR
variable, as set by Cargo.
The function works on a best-effort basis: if git is not available
or no git repository is present, it will fail gracefully by
returning Ok(None)
.