mirror of https://github.com/docker/docs.git
Merge pull request #2927 from andrewsmedina/stat_macos
Move syscall.Stats logic to os specific file.
This commit is contained in:
commit
597ca192e7
|
@ -181,7 +181,7 @@ func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) {
|
||||||
oldStat.Rdev != newStat.Rdev ||
|
oldStat.Rdev != newStat.Rdev ||
|
||||||
// Don't look at size for dirs, its not a good measure of change
|
// Don't look at size for dirs, its not a good measure of change
|
||||||
(oldStat.Size != newStat.Size && oldStat.Mode&syscall.S_IFDIR != syscall.S_IFDIR) ||
|
(oldStat.Size != newStat.Size && oldStat.Mode&syscall.S_IFDIR != syscall.S_IFDIR) ||
|
||||||
oldStat.Mtim != newStat.Mtim {
|
getLastModification(oldStat) != getLastModification(newStat) {
|
||||||
change := Change{
|
change := Change{
|
||||||
Path: newChild.path(),
|
Path: newChild.path(),
|
||||||
Kind: ChangeModify,
|
Kind: ChangeModify,
|
||||||
|
|
|
@ -83,8 +83,10 @@ func ApplyLayer(dest string, layer Archive) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range modifiedDirs {
|
for k, v := range modifiedDirs {
|
||||||
aTime := time.Unix(v.Atim.Unix())
|
lastAccess := getLastAccess(v)
|
||||||
mTime := time.Unix(v.Mtim.Unix())
|
lastModification := getLastModification(v)
|
||||||
|
aTime := time.Unix(lastAccess.Unix())
|
||||||
|
mTime := time.Unix(lastModification.Unix())
|
||||||
|
|
||||||
if err := os.Chtimes(k, aTime, mTime); err != nil {
|
if err := os.Chtimes(k, aTime, mTime); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package archive
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func getLastAccess(stat *syscall.Stat_t) syscall.Timespec {
|
||||||
|
return stat.Atimespec
|
||||||
|
}
|
||||||
|
|
||||||
|
func getLastModification(stat *syscall.Stat_t) syscall.Timespec {
|
||||||
|
return stat.Mtimespec
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package archive
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func getLastAccess(stat *syscall.Stat_t) syscall.Timespec {
|
||||||
|
return stat.Atim
|
||||||
|
}
|
||||||
|
|
||||||
|
func getLastModification(stat *syscall.Stat_t) syscall.Timespec {
|
||||||
|
return stat.Mtim
|
||||||
|
}
|
Loading…
Reference in New Issue