1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00

reuse timestamp, don't call time.Now() 3 times

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: b64209f7b6818337a90d2f04627664b5964a29ce
Component: engine
This commit is contained in:
unclejack
2014-05-31 03:03:51 +03:00
parent 1f86bb208b
commit 3acef7fcd0

View File

@@ -352,12 +352,13 @@ func ExportChanges(dir string, changes []Change) (Archive, error) {
whiteOutDir := filepath.Dir(change.Path)
whiteOutBase := filepath.Base(change.Path)
whiteOut := filepath.Join(whiteOutDir, ".wh."+whiteOutBase)
timestamp := time.Now()
hdr := &tar.Header{
Name: whiteOut[1:],
Size: 0,
ModTime: time.Now(),
AccessTime: time.Now(),
ChangeTime: time.Now(),
ModTime: timestamp,
AccessTime: timestamp,
ChangeTime: timestamp,
}
if err := tw.WriteHeader(hdr); err != nil {
utils.Debugf("Can't write whiteout header: %s\n", err)