use crate::Index;
use git_repository as git;
use std::str;
static INDEX_GIT_URL: &str = "https://github.com/rust-lang/crates.io-index";
static LAST_SEEN_REFNAME: &str = "refs/heads/crates-index-diff_last-seen";
pub struct CloneOptions<'a> {
pub repository_url: String,
pub fetch_options: Option<git2::FetchOptions<'a>>,
}
impl<'a> Default for CloneOptions<'a> {
fn default() -> Self {
CloneOptions {
repository_url: INDEX_GIT_URL.into(),
fetch_options: None,
}
}
}
impl Index {
pub fn repository(&self) -> &git::Repository {
&self.repo
}
pub fn repository_mut(&mut self) -> &mut git::Repository {
&mut self.repo
}
pub fn last_seen_reference(
&self,
) -> Result<git::Reference<'_>, git::reference::find::existing::Error> {
self.repo.find_reference(self.seen_ref_name)
}
}
pub mod diff;
pub mod init;