#git-repository

build git_info2

Extracts git repository information

1 unstable release

0.1.2 Mar 10, 2024

#577 in Build Utils


Used in harness-cli

Apache-2.0

785KB
440 lines

Contains (WOFF font, 190KB) docs/api/FiraSans-Medium.woff, (WOFF font, 185KB) docs/api/FiraSans-Regular.woff, (WOFF font, 94KB) docs/api/SourceSerifPro-Bold.ttf.woff, (WOFF font, 89KB) docs/api/SourceSerifPro-Regular.ttf.woff, (WOFF font, 56KB) docs/api/SourceCodePro-Regular.woff, (WOFF font, 56KB) docs/api/SourceCodePro-Semibold.woff and 1 more.

git_info

crates.io CI codecov
license Libraries.io for GitHub Documentation downloads
Built with cargo-make

Extracts git repository information.

Forked from sagiegurari/git_info.

Overview

This library main goal is to provide development/build tools such as cargo-make the needed information on the current git repository.

Usage

Simply include the library and invoke the get function to pull all info as follows:

fn main() {
    let info = git_info2::get();

    println!(
        "User Name: {}",
        info.user_name.unwrap_or("Unknown".to_string())
    );
    println!(
        "User Email: {}",
        info.user_email.unwrap_or("Unknown".to_string())
    );
    println!("Dirty: {}", info.dirty.unwrap_or(false));
    println!(
        "Current Branch: {}",
        info.current_branch.unwrap_or("Unknown".to_string())
    );

    println!(
        "Last Commit Hash: {}",
        info.head.last_commit_hash.unwrap_or("Unknown".to_string())
    );
    println!(
        "Last Commit Hash (short): {}",
        info.head
            .last_commit_hash_short
            .unwrap_or("Unknown".to_string())
    );

    println!("Config: {:#?}", info.config.unwrap());
    println!("Branches: {:#?}", info.branches.unwrap_or(vec![]));
}

Installation

In order to use this library, just add it as a dependency:

[dependencies]
git_info = "^0.1.2"

API Documentation

See full docs at: API Docs

Contributing

See contributing guide

Release History

See Changelog

License

Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.

No runtime deps