#git #utility

git-meta

A basic git repo metadata inspection tool

9 releases (breaking)

Uses new Rust 2021

0.6.0 Jan 23, 2022
0.5.0 Dec 20, 2021
0.4.0 Nov 14, 2021
0.3.1 Feb 27, 2021
0.0.1 Feb 6, 2021

#97 in Build Utils

Download history 6/week @ 2022-03-09 48/week @ 2022-03-16 21/week @ 2022-03-23 6/week @ 2022-03-30 7/week @ 2022-04-06 6/week @ 2022-04-13 5/week @ 2022-04-20 58/week @ 2022-04-27 43/week @ 2022-05-04 141/week @ 2022-05-11 43/week @ 2022-05-18 52/week @ 2022-05-25 69/week @ 2022-06-01 28/week @ 2022-06-08 5/week @ 2022-06-15 7/week @ 2022-06-22

109 downloads per month
Used in git-event

MIT license

50KB
962 lines

git-meta

Crates.io docs.rs licence Github actions build status

Git-meta is a collection of functionality for gathering information about git repos and commits


lib.rs:

Git-meta

Git-meta is a collection of functionality for gathering information about git repos and commits You can open an existing repo with GitRepo::open(path) (Branch and commits provided for example. Provide None to use current checked out values)

use std::path::PathBuf;
use git_meta::GitRepo;
GitRepo::open(
        PathBuf::from("/path/to/repo"),
        Some("main".to_string()),
        Some("b24fe6112e97eb9ee0cc1fd5aaa520bf8814f6c3".to_string()))
    .expect("Unable to clone repo");

You can create a new repo for cloning with GitRepo::new(url)

use std::path::PathBuf;
use git_meta::{GitCredentials, GitRepo};
use mktemp::Temp;
let temp_dir = Temp::new_dir().expect("Unable to create test clone dir");

let creds = GitCredentials::SshKey {
    username: "git".to_string(),
    public_key: None,
    private_key: PathBuf::from("/path/to/private/key"),
    passphrase: None,
};

GitRepo::new("https://github.com/tjtelan/git-meta-rs")
    .expect("Unable to create GitRepo")
    .with_credentials(Some(creds))
    .to_clone()
    .git_clone_shallow(temp_dir.as_path())
    .expect("Unable to clone repo");

Note: Shallow cloning requires git CLI to be installed

Dependencies

~18MB
~422K SLoC