mirror of
https://github.com/containers/skopeo.git
synced 2025-06-03 12:09:46 +00:00
Add minimal comments to fixManifestLayers
This does not really go into why duplicate layers can happen or why it
is worth supporting that; the code originates from
504e67b867
,
which does not explain either.
This commit is contained in:
parent
a8a3cc3525
commit
cab18e48ad
@ -212,11 +212,18 @@ func (i *genericImage) getLayer(dest types.ImageDestination, digest string) erro
|
|||||||
return dest.PutLayer(digest, stream)
|
return dest.PutLayer(digest, stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fixManifestLayers, after validating the supplied manifest
|
||||||
|
// (to use correctly-formatted IDs, and to not have non-consecutive ID collisions in manifest.History),
|
||||||
|
// modifies manifest to only have one entry for each layer ID in manifest.History (deleting the older duplicates,
|
||||||
|
// both from manifest.History and manifest.FSLayers).
|
||||||
|
// Note that even after this succeeds, manifest.FSLayers may contain duplicate entries
|
||||||
|
// (for Dockerfile operations which change the configuration but not the filesystem).
|
||||||
func fixManifestLayers(manifest *manifestSchema1) error {
|
func fixManifestLayers(manifest *manifestSchema1) error {
|
||||||
type imageV1 struct {
|
type imageV1 struct {
|
||||||
ID string
|
ID string
|
||||||
Parent string
|
Parent string
|
||||||
}
|
}
|
||||||
|
// Per the specification, we can assume that len(manifest.FSLayers) == len(manifest.History)
|
||||||
imgs := make([]*imageV1, len(manifest.FSLayers))
|
imgs := make([]*imageV1, len(manifest.FSLayers))
|
||||||
for i := range manifest.FSLayers {
|
for i := range manifest.FSLayers {
|
||||||
img := &imageV1{}
|
img := &imageV1{}
|
||||||
|
Loading…
Reference in New Issue
Block a user