Revert "small perf optimizing. Only remove whiteout path if it needs to be included in the tar"

This reverts commit 67db51810b.
This commit is contained in:
Tejal Desai 2020-05-06 12:08:44 -07:00
parent a9e78a778f
commit 23ac909b2d
1 changed files with 7 additions and 4 deletions

View File

@ -161,15 +161,18 @@ func GetFSFromLayers(root string, layers []v1.Layer, opts ...FSOpt) ([]string, e
dir := filepath.Dir(path)
if strings.HasPrefix(base, ".wh.") {
if !cfg.includeWhiteout {
logrus.Debug("not including whiteout files")
continue
}
logrus.Debugf("Whiting out %s", path)
name := strings.TrimPrefix(base, ".wh.")
if err := os.RemoveAll(filepath.Join(dir, name)); err != nil {
return nil, errors.Wrapf(err, "removing whiteout %s", hdr.Name)
}
if !cfg.includeWhiteout {
logrus.Debug("not including whiteout files")
continue
}
}
if err := cfg.extractFunc(root, hdr, tr); err != nil {