Files
radicle-git/archived/git-commit/t/src/integration.rs
T
Fintan Halpenny 1668d9fab3 Archive crates
Move git-commit, git-trailers, and link-git to an archived directory
to hide them away -- showing the intent that radicle-git-ext will be
the main crate for git functionality.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-27 11:01:21 +01:00

29 lines
787 B
Rust

use std::io;
use git_commit::Commit;
use test_helpers::tempdir::WithTmpDir;
#[test]
fn valid_commits() {
let radicle_git = format!(
"file://{}",
git2::Repository::discover(".").unwrap().path().display()
);
let repo = WithTmpDir::new(|path| {
let repo = git2::Repository::clone(&radicle_git, path)
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
Ok::<_, io::Error>(repo)
})
.unwrap();
let mut walk = repo.revwalk().unwrap();
walk.push_head().unwrap();
// take the first 20 commits and make sure we can parse them
for oid in walk.take(20) {
let oid = oid.unwrap();
let commit = Commit::read(&repo, oid);
assert!(commit.is_ok(), "Oid: {oid}, Error: {commit:?}")
}
}