mirror of https://github.com/docker/docs.git
Merge pull request #6127 from unclejack/reuse_timestamp
reuse timestamp, don't call time.Now() 3 times
This commit is contained in:
commit
efb4ebcfe8
|
@ -352,12 +352,13 @@ func ExportChanges(dir string, changes []Change) (Archive, error) {
|
||||||
whiteOutDir := filepath.Dir(change.Path)
|
whiteOutDir := filepath.Dir(change.Path)
|
||||||
whiteOutBase := filepath.Base(change.Path)
|
whiteOutBase := filepath.Base(change.Path)
|
||||||
whiteOut := filepath.Join(whiteOutDir, ".wh."+whiteOutBase)
|
whiteOut := filepath.Join(whiteOutDir, ".wh."+whiteOutBase)
|
||||||
|
timestamp := time.Now()
|
||||||
hdr := &tar.Header{
|
hdr := &tar.Header{
|
||||||
Name: whiteOut[1:],
|
Name: whiteOut[1:],
|
||||||
Size: 0,
|
Size: 0,
|
||||||
ModTime: time.Now(),
|
ModTime: timestamp,
|
||||||
AccessTime: time.Now(),
|
AccessTime: timestamp,
|
||||||
ChangeTime: time.Now(),
|
ChangeTime: timestamp,
|
||||||
}
|
}
|
||||||
if err := tw.WriteHeader(hdr); err != nil {
|
if err := tw.WriteHeader(hdr); err != nil {
|
||||||
utils.Debugf("Can't write whiteout header: %s\n", err)
|
utils.Debugf("Can't write whiteout header: %s\n", err)
|
||||||
|
|
Loading…
Reference in New Issue