pkg/archive
Shijiang Wei e10c7b3f07 Add the parent directory to changes set if new files are generated
The "TestChangesWithChanges" case randomlly fails on my development
VM with the following errors:
```
--- FAIL: TestChangesWithChanges (0.00s)
        changes_test.go:201: no change for expected change C /dir1/subfolder != A /dir1/subfolder/newFile
```

If I apply the following patch to changes_test.go, the test passes.

```diff
diff --git a/pkg/archive/changes_test.go b/pkg/archive/changes_test.go
index 290b2dd..ba1aca0 100644
--- a/pkg/archive/changes_test.go
+++ b/pkg/archive/changes_test.go
@@ -156,6 +156,7 @@ func TestChangesWithChanges(t *testing.T) {
        }
        defer os.RemoveAll(layer)
        createSampleDir(t, layer)
+       time.Sleep(5 * time.Millisecond)
        os.MkdirAll(path.Join(layer, "dir1/subfolder"), 0740)

        // Let's modify modtime for dir1 to be sure it's the same for the two layer (to not having false positive)
```

It seems that if a file is created immediately after the directory is created,
the `archive.Changes` function could't recognize that the parent directory of
the new file is modified.

Perhaps the problem may reproduce on machines with low time precision?
I had successfully reproduced the failure on my development VM as well as
a VM on DigitalOcean.

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-06-10 20:29:29 +08:00
..
testdata Move archive package into pkg/archive 2014-09-29 23:23:36 -07:00
archive.go Windows: Archive package changes for Windows daemon 2015-05-20 08:55:54 -07:00
archive_test.go Finally remove our copy of "archive/tar" now that Go 1.4 is the minimum! 2015-05-01 16:01:10 -06:00
archive_unix.go Windows: Archive package changes for Windows daemon 2015-05-20 08:55:54 -07:00
archive_unix_test.go pkg/archive: adjust chmod bits on windows 2015-03-04 14:10:37 -08:00
archive_windows.go Windows: Archive package changes for Windows daemon 2015-05-20 08:55:54 -07:00
archive_windows_test.go trivial: typo cleanup 2015-04-27 13:35:08 -07:00
changes.go Add the parent directory to changes set if new files are generated 2015-06-10 20:29:29 +08:00
changes_posix_test.go pkg/archive: test that confirms hardlink ordering 2015-02-06 18:14:38 +01:00
changes_test.go Add the parent directory to changes set if new files are generated 2015-06-10 20:29:29 +08:00
changes_unix.go Windows: Archive package changes for Windows daemon 2015-05-20 08:55:54 -07:00
changes_windows.go Windows: Archive package changes for Windows daemon 2015-05-20 08:55:54 -07:00
diff.go Windows: Archive package changes for Windows daemon 2015-05-20 08:55:54 -07:00
diff_test.go Finally remove our copy of "archive/tar" now that Go 1.4 is the minimum! 2015-05-01 16:01:10 -06:00
example_changes.go archive: example app for diffing directories 2014-10-29 14:52:59 -04:00
README.md Move archive package into pkg/archive 2014-09-29 23:23:36 -07:00
time_linux.go Move archive package into pkg/archive 2014-09-29 23:23:36 -07:00
time_unsupported.go Move archive package into pkg/archive 2014-09-29 23:23:36 -07:00
utils_test.go Finally remove our copy of "archive/tar" now that Go 1.4 is the minimum! 2015-05-01 16:01:10 -06:00
wrap.go Finally remove our copy of "archive/tar" now that Go 1.4 is the minimum! 2015-05-01 16:01:10 -06:00
wrap_test.go Add coverage on pkg/archive 2015-04-24 17:03:33 +02:00

This code provides helper functions for dealing with archive files.