Crate git_meta[−][src]
Expand description
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))
.git_clone_shallow(temp_dir.as_path())
.expect("Unable to clone repo");
Note: Shallow cloning requires git
CLI to be installed
Structs
GitCommitMeta
holds basic info about a single commit
Use GitRepo::open()
to read a repo on disk. GitRepo::new()
if you need to clone the repo.
Enums
GitCredentials
holds authentication information for a remote git repository