From 921d382b1bfbc912de7d22f7a3c17573f05126ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 16 Apr 2024 20:29:50 +0200 Subject: [PATCH 1/2] Avoid a redundant function call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This primarily ensures that we log and use the same value. Should not change behavior. Signed-off-by: Miloslav Trmač --- copy/single.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/single.go b/copy/single.go index e1a43f75e..4d3bac806 100644 --- a/copy/single.go +++ b/copy/single.go @@ -704,7 +704,7 @@ func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, to canChangeLayerCompression := ic.src.CanChangeLayerCompression(srcInfo.MediaType) logrus.Debugf("Checking if we can reuse blob %s: general substitution = %v, compression for MIME type %q = %v", srcInfo.Digest, ic.canSubstituteBlobs, srcInfo.MediaType, canChangeLayerCompression) - canSubstitute := ic.canSubstituteBlobs && ic.src.CanChangeLayerCompression(srcInfo.MediaType) + canSubstitute := ic.canSubstituteBlobs && canChangeLayerCompression var requiredCompression *compressiontypes.Algorithm if ic.requireCompressionFormatMatch { From 55c319468527a253c5c2cb9e4cf14a390dee4e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 18 Apr 2024 15:50:54 +0200 Subject: [PATCH 2/2] Remove a redundant debug log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The caller logs the same thing, and is in better position to make the decision. Signed-off-by: Miloslav Trmač --- storage/storage_dest.go | 1 - 1 file changed, 1 deletion(-) diff --git a/storage/storage_dest.go b/storage/storage_dest.go index b15c9c3b5..8c62c67a4 100644 --- a/storage/storage_dest.go +++ b/storage/storage_dest.go @@ -930,7 +930,6 @@ func (s *storageImageDestination) untrustedLayerDiffID(layerIndex int) (digest.D // nothing is writing to s.manifest yet, or PutManifest has been called and s.manifest != nil. // Either way this function does not need the protection of s.lock. if s.manifest == nil { - logrus.Debugf("Skipping commit for layer %d, manifest not yet available", layerIndex) return "", nil }