| 1 | package fsutilscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.21 bytes/" |
| 5 | "contextscip-go gomod github.com/golang/go/src go1.21 context/" |
| 6 | "crypto/sha256scip-go gomod github.com/golang/go/src go1.21 `crypto/sha256`/" |
| 7 | "encoding/binaryscip-go gomod github.com/golang/go/src go1.21 `encoding/binary`/" |
| 8 | "hashscip-go gomod github.com/golang/go/src go1.21 hash/" |
| 9 | "ioscip-go gomod github.com/golang/go/src go1.21 io/" |
| 10 | gofsscip-go gomod github.com/golang/go/src go1.21 `io/fs`/ "io/fsscip-go gomod github.com/golang/go/src go1.21 `io/fs`/" |
| 11 | "osscip-go gomod github.com/golang/go/src go1.21 os/" |
| 12 | "path/filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/" |
| 13 | "runtimescip-go gomod github.com/golang/go/src go1.21 runtime/" |
| 14 | "syncscip-go gomod github.com/golang/go/src go1.21 sync/" |
| 15 | "testingscip-go gomod github.com/golang/go/src go1.21 testing/" |
| 16 | "timescip-go gomod github.com/golang/go/src go1.21 time/" |
| 17 | |
| 18 | "github.com/opencontainers/go-digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/" |
| 19 | "github.com/pkg/errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/" |
| 20 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/" |
| 21 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/" |
| 22 | "github.com/tonistiigi/fsutil/typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/" |
| 23 | "golang.org/x/sync/errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/" |
| 24 | ) |
| 25 | |
| 26 | func TestSendErrorscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/TestSendError().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 27 | fs := &testErrFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#{errscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#err.: errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/.Newscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/New().("foo bar")} |
| 28 | |
| 29 | dest := t.TempDirscip-go gomod github.com/golang/go/src go1.21 testing/common#TempDir().() |
| 30 | |
| 31 | ts := newNotificationBufferscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/newNotificationBuffer().() |
| 32 | chs := &changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#{fnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#fn.: ts.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#HandleChange().} |
| 33 | |
| 34 | eg, ctx := errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/.WithContextscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/WithContext().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().()) |
| 35 | s1, s2 := sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx) |
| 36 | |
| 37 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 38 | defer s1.(*fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#).closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() |
| 39 | err := Sendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Send().(ctx, s1, fs, nil) |
| 40 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Contains().(t, err.Error(), "foo bar") |
| 41 | return err |
| 42 | }) |
| 43 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 44 | err := Receivescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Receive().(ctx, s2, dest, ReceiveOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#{ |
| 45 | NotifyHashedscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#NotifyHashed.: chs.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#HandleChange()., |
| 46 | ContentHasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#ContentHasher.: simpleSHA256Hasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/simpleSHA256Hasher()., |
| 47 | }) |
| 48 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Contains().(t, err.Error(), "error from sender:") |
| 49 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Contains().(t, err.Error(), "foo bar") |
| 50 | return err |
| 51 | }) |
| 52 | |
| 53 | errCh := make(chan error) |
| 54 | go func() { |
| 55 | errCh <- eg.Waitscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Wait().() |
| 56 | }() |
| 57 | select { |
| 58 | case <-timescip-go gomod github.com/golang/go/src go1.21 time/.Afterscip-go gomod github.com/golang/go/src go1.21 time/After().(15 * timescip-go gomod github.com/golang/go/src go1.21 time/.Secondscip-go gomod github.com/golang/go/src go1.21 time/Second.): |
| 59 | t.Fatalscip-go gomod github.com/golang/go/src go1.21 testing/common#Fatal().("timeout") |
| 60 | case err := <-errCh: |
| 61 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Contains().(t, err.Error(), "foo bar") |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func TestCopyWithSubDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/TestCopyWithSubDir().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 66 | requiresRootscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/requiresRoot().(t) |
| 67 | |
| 68 | d, err := tmpDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/tmpDir().(changeStreamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changeStream().([]string{ |
| 69 | "ADD foo dir", |
| 70 | "ADD foo/bar file data1", |
| 71 | })) |
| 72 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 73 | defer osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(d) |
| 74 | fs, err := NewFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFS().(d) |
| 75 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 76 | |
| 77 | dest := t.TempDirscip-go gomod github.com/golang/go/src go1.21 testing/common#TempDir().() |
| 78 | |
| 79 | eg, ctx := errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/.WithContextscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/WithContext().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().()) |
| 80 | s1, s2 := sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx) |
| 81 | |
| 82 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 83 | defer s1.(*fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#).closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() |
| 84 | subdir, err := SubDirFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/SubDirFS().([]Dirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Dir#{{FSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Dir#FS.: fs, Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Dir#Stat.: &typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#{Pathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Path.: "sub", Modescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Mode.: uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.ModeDirscip-go gomod github.com/golang/go/src go1.21 os/ModeDir. | 0755)}}}) |
| 85 | if err != nil { |
| 86 | return err |
| 87 | } |
| 88 | return Sendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Send().(ctx, s1, subdir, nil) |
| 89 | }) |
| 90 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 91 | return Receivescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Receive().(ctx, s2, dest, ReceiveOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#{}) |
| 92 | }) |
| 93 | |
| 94 | err = eg.Waitscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Wait().() |
| 95 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 96 | |
| 97 | dt, err := osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "sub/foo/bar")) |
| 98 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 99 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "data1", string(dt)) |
| 100 | } |
| 101 | |
| 102 | func TestCopyDirectoryTimestampsscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/TestCopyDirectoryTimestamps().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 103 | d, err := tmpDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/tmpDir().(changeStreamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changeStream().([]string{ |
| 104 | "ADD foo dir", |
| 105 | "ADD foo/bar file data1", |
| 106 | })) |
| 107 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 108 | defer osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(d) |
| 109 | fs, err := NewFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFS().(d) |
| 110 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 111 | |
| 112 | timestamp := timescip-go gomod github.com/golang/go/src go1.21 time/.Unixscip-go gomod github.com/golang/go/src go1.21 time/Unix().(0, 0) |
| 113 | requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/NoError().(t, osscip-go gomod github.com/golang/go/src go1.21 os/.Chtimesscip-go gomod github.com/golang/go/src go1.21 os/Chtimes().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(d, "foo"), timestamp, timestamp)) |
| 114 | |
| 115 | dest := t.TempDirscip-go gomod github.com/golang/go/src go1.21 testing/common#TempDir().() |
| 116 | |
| 117 | eg, ctx := errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/.WithContextscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/WithContext().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().()) |
| 118 | s1, s2 := sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx) |
| 119 | |
| 120 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 121 | defer s1.(*fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#).closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() |
| 122 | return Sendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Send().(ctx, s1, fs, nil) |
| 123 | }) |
| 124 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 125 | return Receivescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Receive().(ctx, s2, dest, ReceiveOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#{}) |
| 126 | }) |
| 127 | |
| 128 | err = eg.Waitscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Wait().() |
| 129 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 130 | |
| 131 | dt, err := osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "foo/bar")) |
| 132 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 133 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "data1", string(dt)) |
| 134 | |
| 135 | stat, err := osscip-go gomod github.com/golang/go/src go1.21 os/.Statscip-go gomod github.com/golang/go/src go1.21 os/Stat().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "foo")) |
| 136 | requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 137 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, timestamp, stat.ModTimescip-go gomod github.com/golang/go/src go1.21 `io/fs`/FileInfo#ModTime().()) |
| 138 | } |
| 139 | |
| 140 | func TestCopySwitchDirToFilescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/TestCopySwitchDirToFile().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 141 | d, err := tmpDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/tmpDir().(changeStreamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changeStream().([]string{ |
| 142 | "ADD foo file data1", |
| 143 | })) |
| 144 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 145 | defer osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(d) |
| 146 | |
| 147 | dest, err := tmpDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/tmpDir().(changeStreamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changeStream().([]string{ |
| 148 | "ADD foo dir", |
| 149 | "ADD foo/bar file data2", |
| 150 | })) |
| 151 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 152 | defer osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(dest) |
| 153 | |
| 154 | copy := func(src, dest string) (*changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#, error) { |
| 155 | ts := newNotificationBufferscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/newNotificationBuffer().() |
| 156 | chs := &changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#{fnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#fn.: ts.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#HandleChange().} |
| 157 | |
| 158 | eg, ctx := errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/.WithContextscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/WithContext().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().()) |
| 159 | s1, s2 := sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx) |
| 160 | |
| 161 | fs, err := NewFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFS().(src) |
| 162 | if err != nil { |
| 163 | return nil, err |
| 164 | } |
| 165 | fs, err = NewFilterFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFilterFS().(fs, &FilterOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#{ |
| 166 | Mapscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#Map.: func(_ string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) MapResultscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/MapResult# { |
| 167 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = 0 |
| 168 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = 0 |
| 169 | return MapResultKeepscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/MapResultKeep. |
| 170 | }, |
| 171 | }) |
| 172 | if err != nil { |
| 173 | return nil, err |
| 174 | } |
| 175 | |
| 176 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 177 | defer s1.(*fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#).closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() |
| 178 | return Sendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Send().(ctx, s1, fs, nil) |
| 179 | }) |
| 180 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 181 | return Receivescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Receive().(ctx, s2, dest, ReceiveOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#{ |
| 182 | NotifyHashedscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#NotifyHashed.: chs.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#HandleChange()., |
| 183 | ContentHasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#ContentHasher.: simpleSHA256Hasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/simpleSHA256Hasher()., |
| 184 | Filterscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#Filter.: func(_ string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) bool { |
| 185 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. != "windows" { |
| 186 | // On Windows, Getuid() and Getgid() always return -1 |
| 187 | // See: https://pkg.go.dev/os#Getgid |
| 188 | // See: https://pkg.go.dev/os#Geteuid |
| 189 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getuidscip-go gomod github.com/golang/go/src go1.21 os/Getuid().()) |
| 190 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getgidscip-go gomod github.com/golang/go/src go1.21 os/Getgid().()) |
| 191 | } |
| 192 | return true |
| 193 | }, |
| 194 | }) |
| 195 | }) |
| 196 | |
| 197 | if err := eg.Waitscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Wait().(); err != nil { |
| 198 | return nil, err |
| 199 | } |
| 200 | |
| 201 | return chs, nil |
| 202 | } |
| 203 | |
| 204 | chs, err := copy(d, dest) |
| 205 | requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 206 | |
| 207 | k, ok := chs.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c.["foo"] |
| 208 | requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/True().(t, ok) |
| 209 | requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/Equal().(t, k, ChangeKindAddscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeKindAdd.) |
| 210 | requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/Equal().(t, len(chs.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c.), 1) |
| 211 | |
| 212 | b := &bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#{} |
| 213 | err = Walkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Walk().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().(), dest, nil, bufWalkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/bufWalk().(b)) |
| 214 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 215 | |
| 216 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, `file foo |
| 217 | `, b.Stringscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#String().()) |
| 218 | } |
| 219 | |
| 220 | func TestHardlinkFilterscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/TestHardlinkFilter().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 221 | d, err := tmpDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/tmpDir().(changeStreamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changeStream().([]string{ |
| 222 | "ADD bar file data1", |
| 223 | "ADD foo file >bar", |
| 224 | "ADD foo2 file >bar", |
| 225 | })) |
| 226 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 227 | defer osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(d) |
| 228 | |
| 229 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 230 | defer osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(d) |
| 231 | fs, err := NewFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFS().(d) |
| 232 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 233 | fs, err = NewFilterFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFilterFS().(fs, &FilterOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#{}) |
| 234 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 235 | fs, err = NewFilterFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFilterFS().(fs, &FilterOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#{ |
| 236 | IncludePatternsscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#IncludePatterns.: []string{"foo*"}, |
| 237 | Mapscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#Map.: func(_ string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) MapResultscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/MapResult# { |
| 238 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = 0 |
| 239 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = 0 |
| 240 | return MapResultKeepscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/MapResultKeep. |
| 241 | }, |
| 242 | }) |
| 243 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 244 | |
| 245 | dest := t.TempDirscip-go gomod github.com/golang/go/src go1.21 testing/common#TempDir().() |
| 246 | |
| 247 | eg, ctx := errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/.WithContextscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/WithContext().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().()) |
| 248 | s1, s2 := sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx) |
| 249 | |
| 250 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 251 | defer s1.(*fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#).closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() |
| 252 | return Sendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Send().(ctx, s1, fs, nil) |
| 253 | }) |
| 254 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 255 | return Receivescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Receive().(ctx, s2, dest, ReceiveOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#{ |
| 256 | Filterscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#Filter.: func(p string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) bool { |
| 257 | if p == "foo2" { |
| 258 | requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/Equal().(t, "foo", s.Linknamescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Linkname.) |
| 259 | } |
| 260 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. != "windows" { |
| 261 | // On Windows, Getuid() and Getgid() always return -1 |
| 262 | // See: https://pkg.go.dev/os#Getgid |
| 263 | // See: https://pkg.go.dev/os#Geteuid |
| 264 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getuidscip-go gomod github.com/golang/go/src go1.21 os/Getuid().()) |
| 265 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getgidscip-go gomod github.com/golang/go/src go1.21 os/Getgid().()) |
| 266 | } |
| 267 | return true |
| 268 | }, |
| 269 | }) |
| 270 | }) |
| 271 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, eg.Waitscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Wait().()) |
| 272 | |
| 273 | dt, err := osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "foo")) |
| 274 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 275 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "data1", string(dt)) |
| 276 | |
| 277 | st1, err := osscip-go gomod github.com/golang/go/src go1.21 os/.Statscip-go gomod github.com/golang/go/src go1.21 os/Stat().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "foo")) |
| 278 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 279 | |
| 280 | st2, err := osscip-go gomod github.com/golang/go/src go1.21 os/.Statscip-go gomod github.com/golang/go/src go1.21 os/Stat().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "foo2")) |
| 281 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 282 | |
| 283 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, osscip-go gomod github.com/golang/go/src go1.21 os/.SameFilescip-go gomod github.com/golang/go/src go1.21 os/SameFile().(st1, st2)) |
| 284 | } |
| 285 | |
| 286 | func TestCopySimplescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/TestCopySimple().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 287 | d, err := tmpDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/tmpDir().(changeStreamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changeStream().([]string{ |
| 288 | "ADD foo file data1", |
| 289 | "ADD foo2 file dat2", |
| 290 | "ADD zzz dir", |
| 291 | "ADD zzz/aa file data3", |
| 292 | "ADD zzz/bb dir", |
| 293 | "ADD zzz/bb/cc dir", |
| 294 | "ADD zzz/bb/cc/dd symlink ../../", |
| 295 | "ADD zzz.aa zzdata", |
| 296 | })) |
| 297 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 298 | defer osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(d) |
| 299 | fs, err := NewFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFS().(d) |
| 300 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 301 | fs, err = NewFilterFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFilterFS().(fs, &FilterOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#{ |
| 302 | Mapscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#Map.: func(_ string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) MapResultscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/MapResult# { |
| 303 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = 0 |
| 304 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = 0 |
| 305 | return MapResultKeepscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/MapResultKeep. |
| 306 | }, |
| 307 | }) |
| 308 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 309 | |
| 310 | dest := t.TempDirscip-go gomod github.com/golang/go/src go1.21 testing/common#TempDir().() |
| 311 | |
| 312 | ts := newNotificationBufferscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/newNotificationBuffer().() |
| 313 | chs := &changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#{fnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#fn.: ts.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#HandleChange().} |
| 314 | |
| 315 | eg, ctx := errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/.WithContextscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/WithContext().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().()) |
| 316 | s1, s2 := sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx) |
| 317 | |
| 318 | tm := timescip-go gomod github.com/golang/go/src go1.21 time/.Nowscip-go gomod github.com/golang/go/src go1.21 time/Now().().Truncatescip-go gomod github.com/golang/go/src go1.21 time/Time#Truncate().(timescip-go gomod github.com/golang/go/src go1.21 time/.Hourscip-go gomod github.com/golang/go/src go1.21 time/Hour.) |
| 319 | |
| 320 | var processCbWasCalled bool |
| 321 | progressCb := func(size int, last bool) { |
| 322 | processCbWasCalled = true |
| 323 | } |
| 324 | |
| 325 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 326 | defer s1.(*fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#).closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() |
| 327 | return Sendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Send().(ctx, s1, fs, progressCb) |
| 328 | }) |
| 329 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 330 | return Receivescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Receive().(ctx, s2, dest, ReceiveOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#{ |
| 331 | NotifyHashedscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#NotifyHashed.: chs.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#HandleChange()., |
| 332 | ContentHasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#ContentHasher.: simpleSHA256Hasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/simpleSHA256Hasher()., |
| 333 | Filterscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#Filter.: func(p string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) bool { |
| 334 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. != "windows" { |
| 335 | // On Windows, Getuid() and Getgid() always return -1 |
| 336 | // See: https://pkg.go.dev/os#Getgid |
| 337 | // See: https://pkg.go.dev/os#Geteuid |
| 338 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getuidscip-go gomod github.com/golang/go/src go1.21 os/Getuid().()) |
| 339 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getgidscip-go gomod github.com/golang/go/src go1.21 os/Getgid().()) |
| 340 | } |
| 341 | s.ModTimescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#ModTime. = tm.UnixNanoscip-go gomod github.com/golang/go/src go1.21 time/Time#UnixNano().() |
| 342 | return true |
| 343 | }, |
| 344 | }) |
| 345 | }) |
| 346 | |
| 347 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, eg.Waitscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Wait().()) |
| 348 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, processCbWasCalled) |
| 349 | |
| 350 | b := &bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#{} |
| 351 | err = Walkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Walk().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().(), dest, nil, bufWalkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/bufWalk().(b)) |
| 352 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 353 | |
| 354 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. == "windows" { |
| 355 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, `file foo |
| 356 | file foo2 |
| 357 | dir zzz |
| 358 | file zzz\aa |
| 359 | dir zzz\bb |
| 360 | dir zzz\bb\cc |
| 361 | symlink:..\..\ zzz\bb\cc\dd |
| 362 | file zzz.aa |
| 363 | `, b.Stringscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#String().()) |
| 364 | } else { |
| 365 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, `file foo |
| 366 | file foo2 |
| 367 | dir zzz |
| 368 | file zzz/aa |
| 369 | dir zzz/bb |
| 370 | dir zzz/bb/cc |
| 371 | symlink:../../ zzz/bb/cc/dd |
| 372 | file zzz.aa |
| 373 | `, b.Stringscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#String().()) |
| 374 | } |
| 375 | |
| 376 | dt, err := osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "zzz/aa")) |
| 377 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 378 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "data3", string(dt)) |
| 379 | |
| 380 | dt, err = osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "foo2")) |
| 381 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 382 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "dat2", string(dt)) |
| 383 | |
| 384 | fi, err := osscip-go gomod github.com/golang/go/src go1.21 os/.Statscip-go gomod github.com/golang/go/src go1.21 os/Stat().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "foo2")) |
| 385 | requirescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 386 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, tm, fi.ModTimescip-go gomod github.com/golang/go/src go1.21 `io/fs`/FileInfo#ModTime().()) |
| 387 | |
| 388 | h, ok := ts.Hashscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#Hash().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/FromSlash().("zzz/aa")) |
| 389 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, ok) |
| 390 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. == "windows" { |
| 391 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:5da6b6a222dca8d9260384da15378d4389f7e16943e812e08c39759b8514b456"), h) |
| 392 | } else { |
| 393 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:99b6ef96ee0572b5b3a4eb28f00b715d820bfd73836e59cc1565e241f4d1bb2f"), h) |
| 394 | } |
| 395 | |
| 396 | h, ok = ts.Hashscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#Hash().("foo2") |
| 397 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, ok) |
| 398 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. == "windows" { |
| 399 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:cd83620e5308f6ddb9953a82b2c7450832eac78521dbf067d2882318cabc1311"), h) |
| 400 | } else { |
| 401 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:dd2529f7749ba45ea55de3b2e10086d6494cc45a94e57650c2882a6a14b4ff32"), h) |
| 402 | } |
| 403 | |
| 404 | h, ok = ts.Hashscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#Hash().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/FromSlash().("zzz/bb/cc/dd")) |
| 405 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, ok) |
| 406 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. == "windows" { |
| 407 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:47dc68d117ae85dc688103d6ba2cee54caabbbcf606e54ca62fda6a3d9deae19"), h) |
| 408 | } else { |
| 409 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:eca07e8f2d09bd574ea2496312e6de1685ef15b8e6a49a534ed9e722bcac8adc"), h) |
| 410 | } |
| 411 | |
| 412 | k, ok := chs.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c.[filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/FromSlash().("zzz/aa")] |
| 413 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, true, ok) |
| 414 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, ChangeKindAddscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeKindAdd., k) |
| 415 | |
| 416 | err = osscip-go gomod github.com/golang/go/src go1.21 os/.WriteFilescip-go gomod github.com/golang/go/src go1.21 os/WriteFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(d, "zzz/bb/cc/foo"), []byte("data5"), 0600) |
| 417 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 418 | |
| 419 | err = osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(d, "foo2")) |
| 420 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 421 | |
| 422 | chs = &changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#{fnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#fn.: ts.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#HandleChange().} |
| 423 | |
| 424 | eg, ctx = errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/.WithContextscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/WithContext().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().()) |
| 425 | s1, s2 = sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx) |
| 426 | |
| 427 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 428 | defer s1.(*fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#).closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() |
| 429 | return Sendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Send().(ctx, s1, fs, nil) |
| 430 | }) |
| 431 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 432 | return Receivescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Receive().(ctx, s2, dest, ReceiveOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#{ |
| 433 | NotifyHashedscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#NotifyHashed.: chs.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#HandleChange()., |
| 434 | ContentHasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#ContentHasher.: simpleSHA256Hasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/simpleSHA256Hasher()., |
| 435 | Filterscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#Filter.: func(_ string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) bool { |
| 436 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. != "windows" { |
| 437 | // On Windows, Getuid() and Getgid() always return -1 |
| 438 | // See: https://pkg.go.dev/os#Getgid |
| 439 | // See: https://pkg.go.dev/os#Geteuid |
| 440 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getuidscip-go gomod github.com/golang/go/src go1.21 os/Getuid().()) |
| 441 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getgidscip-go gomod github.com/golang/go/src go1.21 os/Getgid().()) |
| 442 | } |
| 443 | s.ModTimescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#ModTime. = tm.UnixNanoscip-go gomod github.com/golang/go/src go1.21 time/Time#UnixNano().() |
| 444 | return true |
| 445 | }, |
| 446 | }) |
| 447 | }) |
| 448 | |
| 449 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, eg.Waitscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Wait().()) |
| 450 | |
| 451 | b = &bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#{} |
| 452 | err = Walkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Walk().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().(), dest, nil, bufWalkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/bufWalk().(b)) |
| 453 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 454 | |
| 455 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. == "windows" { |
| 456 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, `file foo |
| 457 | dir zzz |
| 458 | file zzz\aa |
| 459 | dir zzz\bb |
| 460 | dir zzz\bb\cc |
| 461 | symlink:..\..\ zzz\bb\cc\dd |
| 462 | file zzz\bb\cc\foo |
| 463 | file zzz.aa |
| 464 | `, b.Stringscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#String().()) |
| 465 | } else { |
| 466 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, `file foo |
| 467 | dir zzz |
| 468 | file zzz/aa |
| 469 | dir zzz/bb |
| 470 | dir zzz/bb/cc |
| 471 | symlink:../../ zzz/bb/cc/dd |
| 472 | file zzz/bb/cc/foo |
| 473 | file zzz.aa |
| 474 | `, b.Stringscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#String().()) |
| 475 | } |
| 476 | |
| 477 | dt, err = osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "zzz/bb/cc/foo")) |
| 478 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 479 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "data5", string(dt)) |
| 480 | |
| 481 | h, ok = ts.Hashscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#Hash().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/FromSlash().("zzz/bb/cc/dd")) |
| 482 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, ok) |
| 483 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. == "windows" { |
| 484 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:47dc68d117ae85dc688103d6ba2cee54caabbbcf606e54ca62fda6a3d9deae19"), h) |
| 485 | } else { |
| 486 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:eca07e8f2d09bd574ea2496312e6de1685ef15b8e6a49a534ed9e722bcac8adc"), h) |
| 487 | } |
| 488 | |
| 489 | h, ok = ts.Hashscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#Hash().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/FromSlash().("zzz/bb/cc/foo")) |
| 490 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, ok) |
| 491 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. == "windows" { |
| 492 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:9184a7db8d056ee43838613279db9a7ab02272e50d5e20d253393521bb34aa46"), h) |
| 493 | } else { |
| 494 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/.Digestscip-go gomod github.com/opencontainers/go-digest v1.0.0 `github.com/opencontainers/go-digest`/Digest#("sha256:cd14a931fc2e123ded338093f2864b173eecdee578bba6ec24d0724272326c3a"), h) |
| 495 | } |
| 496 | |
| 497 | _, ok = ts.Hashscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#Hash().("foo2") |
| 498 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/False().(t, ok) |
| 499 | |
| 500 | k, ok = chs.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c.["foo2"] |
| 501 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, true, ok) |
| 502 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, ChangeKindDeletescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeKindDelete., k) |
| 503 | |
| 504 | k, ok = chs.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c.[filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/FromSlash().("zzz/bb/cc/foo")] |
| 505 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, true, ok) |
| 506 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, ChangeKindAddscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeKindAdd., k) |
| 507 | |
| 508 | _, ok = chs.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c.[filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/FromSlash().("zzz/aa")] |
| 509 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, false, ok) |
| 510 | |
| 511 | _, ok = chs.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c.["zzz.aa"] |
| 512 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, false, ok) |
| 513 | } |
| 514 | |
| 515 | func TestCopyMetadataOnlyscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/TestCopyMetadataOnly().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) { |
| 516 | d, err := tmpDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/tmpDir().(changeStreamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changeStream().([]string{ |
| 517 | "ADD foo file data1", |
| 518 | "ADD foo2 file dat2", |
| 519 | "ADD zzz dir", |
| 520 | "ADD zzz/aa file data3", |
| 521 | })) |
| 522 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 523 | defer osscip-go gomod github.com/golang/go/src go1.21 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.21 os/RemoveAll().(d) |
| 524 | fs, err := NewFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFS().(d) |
| 525 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 526 | fs, err = NewFilterFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/NewFilterFS().(fs, &FilterOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#{ |
| 527 | Mapscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/FilterOpt#Map.: func(_ string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) MapResultscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/MapResult# { |
| 528 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = 0 |
| 529 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = 0 |
| 530 | return MapResultKeepscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/MapResultKeep. |
| 531 | }, |
| 532 | }) |
| 533 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 534 | |
| 535 | dest := t.TempDirscip-go gomod github.com/golang/go/src go1.21 testing/common#TempDir().() |
| 536 | |
| 537 | ts := newNotificationBufferscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/newNotificationBuffer().() |
| 538 | chs := &changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#{fnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#fn.: ts.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/notificationBuffer#HandleChange().} |
| 539 | |
| 540 | eg, ctx := errgroupscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/.WithContextscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/WithContext().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().()) |
| 541 | s1, s2 := sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx) |
| 542 | |
| 543 | tm := timescip-go gomod github.com/golang/go/src go1.21 time/.Nowscip-go gomod github.com/golang/go/src go1.21 time/Now().().Truncatescip-go gomod github.com/golang/go/src go1.21 time/Time#Truncate().(timescip-go gomod github.com/golang/go/src go1.21 time/.Hourscip-go gomod github.com/golang/go/src go1.21 time/Hour.) |
| 544 | |
| 545 | var processCbWasCalled bool |
| 546 | progressCb := func(size int, last bool) { |
| 547 | processCbWasCalled = true |
| 548 | } |
| 549 | |
| 550 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 551 | defer s1.(*fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#).closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() |
| 552 | return Sendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Send().(ctx, s1, fs, progressCb) |
| 553 | }) |
| 554 | eg.Goscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Go().(func() error { |
| 555 | return Receivescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Receive().(ctx, s2, dest, ReceiveOptscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#{ |
| 556 | NotifyHashedscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#NotifyHashed.: chs.HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#HandleChange()., |
| 557 | ContentHasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#ContentHasher.: simpleSHA256Hasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/simpleSHA256Hasher()., |
| 558 | Filterscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#Filter.: func(p string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) bool { |
| 559 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. != "windows" { |
| 560 | // On Windows, Getuid() and Getgid() always return -1 |
| 561 | // See: https://pkg.go.dev/os#Getgid |
| 562 | // See: https://pkg.go.dev/os#Geteuid |
| 563 | s.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getuidscip-go gomod github.com/golang/go/src go1.21 os/Getuid().()) |
| 564 | s.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = uint32(osscip-go gomod github.com/golang/go/src go1.21 os/.Getgidscip-go gomod github.com/golang/go/src go1.21 os/Getgid().()) |
| 565 | } |
| 566 | s.ModTimescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#ModTime. = tm.UnixNanoscip-go gomod github.com/golang/go/src go1.21 time/Time#UnixNano().() |
| 567 | return true |
| 568 | }, |
| 569 | MetadataOnlyscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ReceiveOpt#MetadataOnly.: func(p string, s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) bool { |
| 570 | return p == "foo2" |
| 571 | }, |
| 572 | }) |
| 573 | }) |
| 574 | |
| 575 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, eg.Waitscip-go gomod golang.org/x/sync v0.1.0 `golang.org/x/sync/errgroup`/Group#Wait().()) |
| 576 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, processCbWasCalled) |
| 577 | |
| 578 | b := &bytesscip-go gomod github.com/golang/go/src go1.21 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#{} |
| 579 | err = Walkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Walk().(contextscip-go gomod github.com/golang/go/src go1.21 context/.Backgroundscip-go gomod github.com/golang/go/src go1.21 context/Background().(), dest, nil, bufWalkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/bufWalk().(b)) |
| 580 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 581 | |
| 582 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, `file .fsutil-metadata |
| 583 | file foo2 |
| 584 | `, b.Stringscip-go gomod github.com/golang/go/src go1.21 bytes/Buffer#String().()) |
| 585 | |
| 586 | dt, err := osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, "foo2")) |
| 587 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 588 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "dat2", string(dt)) |
| 589 | |
| 590 | dt, err = osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(dest, ".fsutil-metadata")) |
| 591 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 592 | |
| 593 | files := parseFSMetadatascip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/parseFSMetadata().(t, dt) |
| 594 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, 4, len(files)) |
| 595 | |
| 596 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "foo", files[0].Pathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Path.) |
| 597 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, int64(5), files[0].Sizescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Size.) |
| 598 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "foo2", files[1].Pathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Path.) |
| 599 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, int64(4), files[1].Sizescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Size.) |
| 600 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "zzz", files[2].Pathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Path.) |
| 601 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, int64(0), files[2].Sizescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Size.) |
| 602 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/True().(t, (&StatInfoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/StatInfo#{&files[2]}).IsDirscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/StatInfo#IsDir().()) |
| 603 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, "zzz/aa", files[3].Pathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Path.) |
| 604 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/Equal().(t, int64(5), files[3].Sizescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Size.) |
| 605 | } |
| 606 | |
| 607 | func parseFSMetadatascip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/parseFSMetadata().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#, dt []byte) []typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat# { |
| 608 | var m []typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat# |
| 609 | for len(dt) > 0 { |
| 610 | var s typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat# |
| 611 | n := binaryscip-go gomod github.com/golang/go/src go1.21 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.21 `encoding/binary`/LittleEndian..Uint32scip-go gomod github.com/golang/go/src go1.21 `encoding/binary`/littleEndian#Uint32().(dt[:4]) |
| 612 | dt = dt[4:] |
| 613 | err := s.Unmarshalscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Unmarshal().(dt[:n]) |
| 614 | assertscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.4 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 615 | m = append(m, *s.CloneVTscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#CloneVT().()) |
| 616 | dt = dt[n:] |
| 617 | } |
| 618 | return m |
| 619 | } |
| 620 | |
| 621 | func sockPairProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/sockPairProto().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#) (Streamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Stream#, Streamscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Stream#) { |
| 622 | c1 := make(chan []byte, 32) |
| 623 | c2 := make(chan []byte, 32) |
| 624 | return &fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#{ctx, c1, c2}, &fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#{ctx, c2, c1} |
| 625 | } |
| 626 | |
| 627 | type fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto# struct { |
| 628 | ctxscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#ctx. contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context# |
| 629 | recvChanscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#recvChan. chan []byte |
| 630 | sendChanscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#sendChan. chan []byte |
| 631 | } |
| 632 | |
| 633 | func (fc *fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#) Contextscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#Context().() contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context# { |
| 634 | return fc.ctxscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#ctx. |
| 635 | } |
| 636 | |
| 637 | func (fc *fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#) RecvMsgscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#RecvMsg().(m interface{}) error { |
| 638 | p, ok := m.(*typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Packetscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Packet#) |
| 639 | if !ok { |
| 640 | return errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/.Errorfscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/Errorf().("invalid msg: %#v", m) |
| 641 | } |
| 642 | select { |
| 643 | case <-fc.ctxscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#ctx..Donescip-go gomod github.com/golang/go/src go1.21 context/Context#Done().(): |
| 644 | return fc.ctxscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#ctx..Errscip-go gomod github.com/golang/go/src go1.21 context/Context#Err().() |
| 645 | case dt, ok := <-fc.recvChanscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#recvChan.: |
| 646 | if !ok { |
| 647 | return ioscip-go gomod github.com/golang/go/src go1.21 io/.EOFscip-go gomod github.com/golang/go/src go1.21 io/EOF. |
| 648 | } |
| 649 | return p.Unmarshalscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Packet#Unmarshal().(dt) |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | func (fc *fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#) SendMsgscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#SendMsg().(m interface{}) error { |
| 654 | p, ok := m.(*typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Packetscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Packet#) |
| 655 | if !ok { |
| 656 | return errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/.Errorfscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/Errorf().("invalid msg: %#v", m) |
| 657 | } |
| 658 | dt, err := p.Marshalscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Packet#Marshal().() |
| 659 | if err != nil { |
| 660 | return err |
| 661 | } |
| 662 | select { |
| 663 | case <-fc.ctxscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#ctx..Donescip-go gomod github.com/golang/go/src go1.21 context/Context#Done().(): |
| 664 | return fc.ctxscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#ctx..Errscip-go gomod github.com/golang/go/src go1.21 context/Context#Err().() |
| 665 | case fc.sendChanscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#sendChan. <- dt: |
| 666 | return nil |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | func (fc *fakeConnProtoscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#) closeSendscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#closeSend().() { |
| 671 | close(fc.sendChanscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/fakeConnProto#sendChan.) |
| 672 | } |
| 673 | |
| 674 | type changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes# struct { |
| 675 | cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c. map[string]ChangeKindscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeKind# |
| 676 | fnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#fn. ChangeFuncscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeFunc# |
| 677 | muscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#mu. syncscip-go gomod github.com/golang/go/src go1.21 sync/.Mutexscip-go gomod github.com/golang/go/src go1.21 sync/Mutex# |
| 678 | } |
| 679 | |
| 680 | func (c *changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#) HandleChangescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#HandleChange().(kind ChangeKindscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeKind#, p string, fi osscip-go gomod github.com/golang/go/src go1.21 os/.FileInfoscip-go gomod github.com/golang/go/src go1.21 os/FileInfo#, err error) error { |
| 681 | c.muscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#mu..Lockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Lock().() |
| 682 | if c.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c. == nil { |
| 683 | c.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c. = make(map[string]ChangeKindscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeKind#) |
| 684 | } |
| 685 | c.cscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#c.[p] = kind |
| 686 | c.muscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#mu..Unlockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Unlock().() |
| 687 | return c.fnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/changes#fn.(kind, p, fi, err) |
| 688 | } |
| 689 | |
| 690 | func simpleSHA256Hasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/simpleSHA256Hasher().(s *typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) (hashscip-go gomod github.com/golang/go/src go1.21 hash/.Hashscip-go gomod github.com/golang/go/src go1.21 hash/Hash#, error) { |
| 691 | h := sha256scip-go gomod github.com/golang/go/src go1.21 `crypto/sha256`/.Newscip-go gomod github.com/golang/go/src go1.21 `crypto/sha256`/New().() |
| 692 | ss := s.Clonescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Clone().() |
| 693 | ss.ModTimescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#ModTime. = 0 |
| 694 | // Unlike Linux, on FreeBSD's stat() call returns -1 in st_rdev for regular files |
| 695 | ss.Devminorscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Devminor. = 0 |
| 696 | ss.Devmajorscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Devmajor. = 0 |
| 697 | if runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. == "windows" { |
| 698 | // On Windows, Getuid() and Getgid() always return -1 |
| 699 | // See: https://pkg.go.dev/os#Getgid |
| 700 | // See: https://pkg.go.dev/os#Geteuid |
| 701 | ss.Uidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Uid. = 0 |
| 702 | ss.Gidscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Gid. = 0 |
| 703 | } |
| 704 | |
| 705 | if osscip-go gomod github.com/golang/go/src go1.21 os/.FileModescip-go gomod github.com/golang/go/src go1.21 os/FileMode#(ss.Modescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Mode.)&osscip-go gomod github.com/golang/go/src go1.21 os/.ModeSymlinkscip-go gomod github.com/golang/go/src go1.21 os/ModeSymlink. != 0 && runtimescip-go gomod github.com/golang/go/src go1.21 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.21 runtime/GOOS. != "windows" { |
| 706 | ss.Modescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Mode. = ss.Modescip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Mode. | 0777 |
| 707 | } |
| 708 | |
| 709 | dt, err := ss.Marshalscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#Marshal().() |
| 710 | if err != nil { |
| 711 | return nil, err |
| 712 | } |
| 713 | h.Writescip-go gomod github.com/golang/go/src go1.21 io/Writer#Write().(dt) |
| 714 | return h, nil |
| 715 | } |
| 716 | |
| 717 | type testErrFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS# struct { |
| 718 | errscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#err. error |
| 719 | } |
| 720 | |
| 721 | func (e *testErrFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#) Walkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#Walk().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, p string, fn gofsscip-go gomod github.com/golang/go/src go1.21 `io/fs`/.WalkDirFuncscip-go gomod github.com/golang/go/src go1.21 `io/fs`/WalkDirFunc#) error { |
| 722 | return errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/.Wrapscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/Wrap().(e.errscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#err., "invalid walk") |
| 723 | } |
| 724 | |
| 725 | func (e *testErrFSscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#) Openscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#Open().(p string) (ioscip-go gomod github.com/golang/go/src go1.21 io/.ReadCloserscip-go gomod github.com/golang/go/src go1.21 io/ReadCloser#, error) { |
| 726 | return nil, errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/.Wrapscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/Wrap().(e.errscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/testErrFS#err., "invalid open") |
| 727 | } |