1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #38888 from quasilyte/fix_copying

image: do actual RootFS.DiffIDs copying in Clone()
This commit is contained in:
Sebastiaan van Stijn 2019-03-21 01:48:27 +01:00 committed by GitHub
commit 8ad6dcf2a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,8 @@ func (r *RootFS) Append(id layer.DiffID) {
func (r *RootFS) Clone() *RootFS { func (r *RootFS) Clone() *RootFS {
newRoot := NewRootFS() newRoot := NewRootFS()
newRoot.Type = r.Type newRoot.Type = r.Type
newRoot.DiffIDs = append(r.DiffIDs) newRoot.DiffIDs = make([]layer.DiffID, len(r.DiffIDs))
copy(newRoot.DiffIDs, r.DiffIDs)
return newRoot return newRoot
} }