Merge pull request #1147 from tejal29/small_perf
small perf optimizing. Only remove whiteout path if it needs to be included in base image
This commit is contained in:
commit
5da32d3f18
|
|
@ -161,18 +161,15 @@ func GetFSFromLayers(root string, layers []v1.Layer, opts ...FSOpt) ([]string, e
|
||||||
dir := filepath.Dir(path)
|
dir := filepath.Dir(path)
|
||||||
|
|
||||||
if strings.HasPrefix(base, ".wh.") {
|
if strings.HasPrefix(base, ".wh.") {
|
||||||
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 {
|
if !cfg.includeWhiteout {
|
||||||
logrus.Debug("not including whiteout files")
|
logrus.Debug("not including whiteout files")
|
||||||
continue
|
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 err := cfg.extractFunc(root, hdr, tr); err != nil {
|
if err := cfg.extractFunc(root, hdr, tr); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue