repo: Add require_rev method

The `resolve_rev` C method should really have been
`resolve_rev_optional` from the start - it is more obviously wrong
in Rust because the input parameter `allows_noent` controls
whether the returned `Option` can ever be `None`.

I debated adding this to the C bindings, and may still do so,
but eh it's faster to write + ship in Rust, and the future of ostree is
Rust anyways.
This commit is contained in:
Colin Walters committed 2022-05-06 12:53:57 -04:00
1 parent faaf0457fd
commit 440d872f68
2 files changed
+11

No files matched your search

+4
View File
@@ -10,9 +10,13 @@ mod checkout_at;
fn should_commit_content_to_repo_and_list_refs_again() {
let test_repo = TestRepo::new();
assert!(test_repo.repo.require_rev("nosuchrev").is_err());
let mtree = create_mtree(&test_repo.repo);
let checksum = commit(&test_repo.repo, &mtree, "test");
assert_eq!(test_repo.repo.require_rev("test").unwrap(), checksum);
let repo = ostree::Repo::new_for_path(test_repo.dir.path());
repo.open(NONE_CANCELLABLE).expect("OSTree test_repo");
let refs = repo