Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/ostree-ext/src/container/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1167,9 +1167,12 @@ impl ImageImporter {
.write_mtree(&mt, cancellable)
.context("Writing mtree")?;
let merged_root = merged_root.downcast::<ostree::RepoFile>().unwrap();
// The merge has the base commit as a parent, if it exists. See
// https://github.com/ostreedev/ostree/pull/3523
let parent = base_commit.as_deref();
let merged_commit = repo
.write_commit_with_time(
None,
parent,
None,
None,
Some(&metadata),
Expand Down
16 changes: 15 additions & 1 deletion crates/ostree-ext/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use oci_spec::image as oci_image;
use ocidir::oci_spec::distribution::Reference;
use ocidir::oci_spec::image::{Arch, DigestAlgorithm};
use ostree_ext::chunking::ObjectMetaSized;
use ostree_ext::container::{store, ManifestDiff};
use ostree_ext::container::{store, ManifestDiff, OSTREE_COMMIT_LABEL};
use ostree_ext::container::{
Config, ExportOpts, ImageReference, OstreeImageReference, SignatureSource, Transport,
};
Expand Down Expand Up @@ -968,6 +968,7 @@ async fn test_container_chunked() -> Result<()> {
let mut fixture = Fixture::new_v1()?;

let (imgref, expected_digest) = fixture.export_container().await.unwrap();
let exported_commit = fixture.srcrepo().require_rev(fixture.testref())?;
let imgref = OstreeImageReference {
sigverify: SignatureSource::ContainerPolicyAllowInsecure,
imgref,
Expand All @@ -990,7 +991,12 @@ async fn test_container_chunked() -> Result<()> {
store::PrepareResult::AlreadyPresent(_) => panic!("should not be already imported"),
store::PrepareResult::Ready(r) => r,
};
let labels = prep.config.labels_of_config().unwrap();
assert!(prep.deprecated_warning().is_none());
assert_eq!(
labels.get(OSTREE_COMMIT_LABEL).unwrap(),
exported_commit.as_str()
);
assert_eq!(prep.version(), Some("42.0"));
let digest = prep.manifest_digest.clone();
assert!(prep.ostree_commit_layer.as_ref().unwrap().commit.is_none());
Expand Down Expand Up @@ -1023,6 +1029,14 @@ async fn test_container_chunked() -> Result<()> {
}
let import = imp.import(prep).await.context("Init pull derived").unwrap();
assert_eq!(import.manifest_digest, digest);
// For now we never expect that these are the same
assert_ne!(import.get_commit(), exported_commit.as_str());
// But the parent should match
let commit_obj = fixture.destrepo().load_commit(import.get_commit())?.0;
assert_eq!(
ostree::commit_get_parent(&commit_obj).unwrap(),
exported_commit.as_str()
);

assert_eq!(store::list_images(fixture.destrepo()).unwrap().len(), 1);

Expand Down