Commit Graph

7 Commits

Author SHA1 Message Date
Derek McGowan
88d59d37fa
Update nanosecond diff comparison
Only check content of files if both files have zero nanosecond times.
A zero nanosecond time is considered ambiguous as to whether or
not the timestamp has been truncated by tar. Previously the diff
algorithm was attempting to account for comparisons from a source
to a directory with an applied tar. This condition is no longer
relevant since there is no support for recreating tars directories
which have had a tar extracted. In the case where the older directory
has a truncated timestamp and the newer one does not, this may always
be considered a change. In the case where both are zero, treat the
timestamp as ambiguous and compare content.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-12-26 14:17:03 -08:00
Akihiro Suda
a3aeb398fe 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>
2017-11-21 04:38:34 +00:00
Michael Crosby
c3872b848f Move RootPath to fs package
This moves the RootPath function out of the archive package and into the
fs package for external use.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-26 14:26:27 -04:00
Derek McGowan
d96e6e3952 Refactor changes and test functions
Remove change type in favor of explicit change function.
Using change function makes it more difficult to unnecessarily
add to the change interface.

Update test apply functions to use an interface rather
than a function type.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-03 11:28:06 -08:00
Derek McGowan
65e8c07847 Update diff interface to use callback
The change computation will be done on the callers thread
and use callbacks rather than running a goroutine and
returning a channel.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-03 11:28:06 -08:00
Derek McGowan
f78105d832 Add support for devices
Address code comments from previous commit

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-03 11:28:06 -08:00
Derek McGowan
574862fd89 Add fs package
Add diff comparison with support for double walking
two trees for comparison or single walking a diff
tree. Single walking requires further implementation
for specific mount types.

Add directory copy function which is intended to provide
fastest possible local copy of file system directories
without hardlinking.

Add test package to make creating filesystems for
test easy and comparisons deep and informative.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-03 11:27:40 -08:00