@cryptotaxi247 / kubo / commits / a6fe80000

unixfs add: Remove hidden file handling

This commit was moved from ipfs/interface-go-ipfs-core@56944d64d1ad4bb349a3d1a30633d5bea06d6a2e This commit was moved from ipfs/boxo@4274224bd095962491241080f0b1fc794d999239

Łukasz Magiera committed Mar 10, 2019 at 22:10 UTC a6fe80000c9e7d17491adc25a02882af3d53a829
2 files changed +1 -64
core/coreiface/options/unixfs.go
-21
@@ -34,8 +34,6 @@ type UnixfsAddSettings struct {
34 NoCopy bool
35
36 Wrap bool
37 - Hidden bool
38 - TopHidden bool
37 StdinName string
38
39 Events chan<- interface{}
@@ -69,8 +67,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix,
67 NoCopy: false,
68
69 Wrap: false,
72 - Hidden: false,
73 - TopHidden: false,
70 StdinName: "",
71
72 Events: nil,
@@ -249,23 +245,6 @@ func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption {
245 }
246 }
247
252 -// Hidden enables adding of hidden files (files prefixed with '.')
253 -func (unixfsOpts) Hidden(hidden bool) UnixfsAddOption {
254 - return func(settings *UnixfsAddSettings) error {
255 - settings.Hidden = hidden
256 - return nil
257 - }
258 -}
259 -
260 -// TopHidden enables adding of hidden files in top-level directory (files
261 -// prefixed with '.')
262 -func (unixfsOpts) TopHidden(hidden bool) UnixfsAddOption {
263 - return func(settings *UnixfsAddSettings) error {
264 - settings.TopHidden = hidden
265 - return nil
266 - }
267 -}
268 -
248 // StdinName is the name set for files which don specify FilePath as
249 // os.Stdin.Name()
250 func (unixfsOpts) StdinName(name string) UnixfsAddOption {
core/coreiface/tests/unixfs.go
+1 -43
@@ -328,7 +328,7 @@ func (tp *provider) TestAdd(t *testing.T) {
328 },
329 // hidden
330 {
331 - name: "hiddenFiles",
331 + name: "hiddenFilesAdded",
332 data: func() files.Node {
333 return files.NewMapDirectory(map[string]files.Node{
334 ".bar": files.NewBytesFile([]byte("hello2")),
@@ -339,48 +339,6 @@ func (tp *provider) TestAdd(t *testing.T) {
339 wrap: "t",
340 expect: wrapped("t"),
341 path: "/ipfs/QmPXLSBX382vJDLrGakcbrZDkU3grfkjMox7EgSC9KFbtQ",
342 - opts: []options.UnixfsAddOption{options.Unixfs.Hidden(true)},
343 - },
344 - {
345 - name: "topHiddenFileAdded",
346 - data: func() files.Node {
347 - return files.NewBytesFile([]byte(helloStr))
348 - },
349 - wrap: ".foo",
350 - expect: wrapped(".foo"),
351 - path: "/ipfs/QmciAVG3krCbvzUaK9gr6jUgfEjQtYmuuXi1n67teQ4Ni2",
352 - opts: []options.UnixfsAddOption{options.Unixfs.TopHidden(true)},
353 - },
354 - {
355 - name: "hiddenFilesNotAdded",
356 - data: func() files.Node {
357 - return files.NewMapDirectory(map[string]files.Node{
358 - ".bar": files.NewBytesFile([]byte("hello2")),
359 - "bar": files.NewBytesFile([]byte("hello2")),
360 - "foo": files.NewBytesFile([]byte("hello1")),
361 - })
362 - },
363 - expect: func(files.Node) files.Node {
364 - return flatDir()
365 - },
366 - path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp",
367 - opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)},
368 - },
369 - {
370 - name: "hiddenFilesWrappedNotAdded",
371 - data: func() files.Node {
372 - return files.NewMapDirectory(map[string]files.Node{
373 - ".bar": files.NewBytesFile([]byte("hello2")),
374 - "bar": files.NewBytesFile([]byte("hello2")),
375 - "foo": files.NewBytesFile([]byte("hello1")),
376 - })
377 - },
378 - expect: func(files.Node) files.Node {
379 - return wrapped("t")(flatDir())
380 - },
381 - wrap: "t",
382 - path: "/ipfs/Qmc3nGXm1HtUVCmnXLQHvWcNwfdZGpfg2SRm1CxLf7Q2Rm",
383 - opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)},
342 },
343 // NoCopy
344 {