fs/diff: support symlink to abspath with second-precision mtime
Previously, `Changes()` for a symlink to absolute path, with second-precision mtime of the link itself always resulted in ENOENT. This is because `compareFileContent()` was called for the link target path, without changing the root path. Fix moby/buildkit#172 Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
@@ -71,10 +71,11 @@ func Chown(name string, uid, gid int) Applier {
|
||||
})
|
||||
}
|
||||
|
||||
// Chtime changes access and mod time of file
|
||||
func Chtime(name string, t time.Time) Applier {
|
||||
// Chtimes changes access and mod time of file.
|
||||
// Use Lchtimes for symbolic links.
|
||||
func Chtimes(name string, atime, mtime time.Time) Applier {
|
||||
return applyFn(func(root string) error {
|
||||
return os.Chtimes(filepath.Join(root, name), t, t)
|
||||
return os.Chtimes(filepath.Join(root, name), atime, mtime)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user