Commit Graph

14 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
Derek McGowan
ba10e497b9
Emit unmodified change events for directories
When a file changes, emit events for the seen parent
directories to ensure that those parents are included
in change streams such as archives. The parents are
needed accurately recreate diff representation apart
from a parent (such as overlay and aufs graph drivers
in Docker).

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-12-04 18:37:00 -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
Daniel Nephin
a72279e53d Skip some tests on windows where the implementation is missing
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-15 14:52:00 -05:00
Daniel Nephin
666d946455 Implement diff.compareSysStat on windows
and update diff tests to work with slash paths on windows

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-15 14:31:50 -05:00
Derek McGowan
8889d459af
Add directory permission tests
Adds tests for verifying parent directory permissions.
Currently an issue exists in extracting into some Docker graph
drivers. Supporting these graph drivers may require changes to
the diff logic, these tests clarify the existing behavior and
that extraction within containerd works.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-06 13:50:04 -08:00
Michael Crosby
b6e0c4f321 Fix go lint errors
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 15:26:44 -04:00
Michael Crosby
4f2b443a27 Rewrite imports for new github org
This rewrites the Go imports after switching to the new github org.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-03 14:05:44 -07:00
Akihiro Suda
750cdc951f snapshotter: add more assertion
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-06 08:34:43 +00:00
Aaron.L.Xu
a3cae915c3 fix some typos
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-02-21 15:02:36 +08:00
Derek McGowan
aaf18b5962 Rename CopyDirectory to CopyDir
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-03 12:08:53 -08: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
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