git-version

Crates.iogit-version
lib.rsgit-version
version0.3.9
sourcesrc
created_at2017-10-18 13:53:05.969696
updated_at2023-12-13 18:22:15.286666
descriptionCompile the git version (tag name, or hash otherwise) and dirty state into your program.
homepage
repositoryhttps://github.com/fusion-engineering/rust-git-version
max_upload_size
id36050
size7,619
Maarten de Vries (de-vri-es)

documentation

https://docs.rs/git-version/

README

git-version

Embed git information in your code at compile-time.

use git_version::git_version;
const GIT_VERSION: &str = git_version!();

The version number will have a -modified suffix if your git worktree had untracked or changed files.

These macros do not depend on libgit, but simply uses the git binary directly. So you must have git installed somewhere in your PATH.

You can also get the version information for all submodules:

use git_version::git_submodule_versions;
const GIT_SUBMODULE_VERSIONS: &[(&str, &str)] = &git_submodule_versions!();

for (path, version) in GIT_SUBMODULE_VERSIONS {
    println!("{path}: {version}");
}

License: BSD-2-Clause

Commit count: 114

cargo fmt