git_version/
lib.rs

1#![no_std]
2
3//! Embed git information in your code at compile-time.
4//!
5//! ```
6//! use git_version::git_version;
7//! const GIT_VERSION: &str = git_version!();
8//! ```
9//!
10//! The version number will have a `-modified` suffix if your git worktree had
11//! untracked or changed files.
12//!
13//! These macros do not depend on libgit, but simply uses the `git` binary directly.
14//! So you must have `git` installed somewhere in your `PATH`.
15//!
16//! You can also get the version information for all submodules:
17//! ```
18//! use git_version::git_submodule_versions;
19//! const GIT_SUBMODULE_VERSIONS: &[(&str, &str)] = &git_submodule_versions!();
20//!
21//! for (path, version) in GIT_SUBMODULE_VERSIONS {
22//!     println!("{path}: {version}");
23//! }
24//! ```
25
26pub use git_version_macro::{git_submodule_versions, git_version};
27
28/// Run `git describe` at compile time with custom flags.
29///
30/// This is just a short-hand for `git_version!(args = [...])`,
31/// to be backwards compatible with earlier versions of this crate.
32#[macro_export]
33macro_rules! git_describe {
34	($($args:tt)*) => {
35		$crate::git_version!(args = [$($args)*])
36	};
37}