reference layer data for source of truth on index
This commit is contained in:
parent
96e9e2561d
commit
46aff8bcc4
@ -303,7 +303,6 @@ func (node *FileNode) compare(other *FileNode) DiffType {
|
||||
if node.Name != other.Name {
|
||||
panic("comparing mismatched nodes")
|
||||
}
|
||||
// TODO: fails on nil
|
||||
|
||||
return node.Data.FileInfo.Compare(other.Data.FileInfo)
|
||||
}
|
||||
|
@ -140,18 +140,18 @@ func (image *dockerImageAnalyzer) Analyze() (*AnalysisResult, error) {
|
||||
// as you iterate chronologically through history (ignoring history items that have no layer contents)
|
||||
layerIdx := len(image.trees) - 1
|
||||
tarPathIdx := 0
|
||||
for idx := 0; idx < len(config.History); idx++ {
|
||||
for histIdx := 0; histIdx < len(config.History); histIdx++ {
|
||||
// ignore empty layers, we are only observing layers with content
|
||||
if config.History[idx].EmptyLayer {
|
||||
if config.History[histIdx].EmptyLayer {
|
||||
continue
|
||||
}
|
||||
|
||||
tree := image.trees[(len(image.trees)-1)-layerIdx]
|
||||
config.History[idx].Size = uint64(tree.FileSize)
|
||||
config.History[histIdx].Size = uint64(tree.FileSize)
|
||||
|
||||
image.layers[layerIdx] = &dockerLayer{
|
||||
history: config.History[idx],
|
||||
index: layerIdx,
|
||||
history: config.History[histIdx],
|
||||
index: tarPathIdx,
|
||||
tree: image.trees[layerIdx],
|
||||
tarPath: manifest.LayerTarPaths[tarPathIdx],
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ func newExport(analysis *image.AnalysisResult) *export {
|
||||
idx := (len(analysis.Layers) - 1) - revIdx
|
||||
|
||||
data.Layer[idx] = exportLayer{
|
||||
Index: idx,
|
||||
Index: layer.Index(),
|
||||
DigestID: layer.Id(),
|
||||
SizeBytes: layer.Size(),
|
||||
Command: layer.Command(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user