unaccounted whiteout files should not be fatal

This commit is contained in:
Alex Goodman 2018-10-24 22:13:08 -04:00
parent 3a1339ff8f
commit b44c980457
No known key found for this signature in database
GPG Key ID: 05328C611D8A520E
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package filetree package filetree
import ( import (
"fmt"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"sort" "sort"
) )
@ -64,9 +65,8 @@ func Efficiency(trees []*FileTree) (float64, EfficiencySlice) {
stackedTree := StackRange(trees, 0, currentTree-1) stackedTree := StackRange(trees, 0, currentTree-1)
previousTreeNode, err := stackedTree.GetNode(node.Path()) previousTreeNode, err := stackedTree.GetNode(node.Path())
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Debug(fmt.Sprintf("CurrentTree: %d : %s", currentTree, err))
} } else if previousTreeNode.Data.FileInfo.TarHeader.FileInfo().IsDir() {
if previousTreeNode.Data.FileInfo.TarHeader.FileInfo().IsDir() {
previousTreeNode.VisitDepthChildFirst(sizer, nil) previousTreeNode.VisitDepthChildFirst(sizer, nil)
} }

View File

@ -215,7 +215,7 @@ func InitializeData(imageID string) ([]*Layer, []*filetree.FileTree, float64, fi
imageTarPath, tmpDir := saveImage(imageID) imageTarPath, tmpDir := saveImage(imageID)
// fmt.Println(imageTarPath) // fmt.Println(imageTarPath)
// fmt.Println(tmpDir) // fmt.Println(tmpDir)
// imageTarPath := "/home/wagoodman/Downloads/image/image.tar" // imageTarPath := "/tmp/dive280665036/image.tar"
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
// read through the image contents and build a tree // read through the image contents and build a tree