Skip to content

Commit

Permalink
Merge pull request #3589 from tonistiigi/truncate-time
Browse files Browse the repository at this point in the history
archive: truncate modification time
  • Loading branch information
crosbymichael committed Aug 28, 2019
2 parents a1579ee + 372472b commit 985bba6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions archive/tar.go
Expand Up @@ -504,6 +504,12 @@ func (cw *changeWriter) HandleChange(k fs.ChangeKind, p string, f os.FileInfo, e

hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode)))

// truncate timestamp for compatibility. without PAX stdlib rounds timestamps instead
hdr.Format = tar.FormatPAX
hdr.ModTime = hdr.ModTime.Truncate(time.Second)
hdr.AccessTime = time.Time{}
hdr.ChangeTime = time.Time{}

name := p
if strings.HasPrefix(name, string(filepath.Separator)) {
name, err = filepath.Rel(string(filepath.Separator), name)
Expand Down

0 comments on commit 985bba6

Please sign in to comment.