diff --git a/core/commands/add.go b/core/commands/add.go index 3087c0e92..bdf24a6e1 100644 --- a/core/commands/add.go +++ b/core/commands/add.go @@ -5,14 +5,16 @@ import ( "fmt" "io" "os" + "path" "strings" "github.com/ipfs/go-ipfs/core/commands/cmdenv" cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" + "github.com/ipfs/go-ipfs-files" coreiface "github.com/ipfs/interface-go-ipfs-core" - options "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/options" mh "github.com/multiformats/go-multihash" pb "gopkg.in/cheggaaa/pb.v1" ) @@ -34,8 +36,6 @@ const ( progressOptionName = "progress" trickleOptionName = "trickle" wrapOptionName = "wrap-with-directory" - stdinPathName = "stdin-name" - hiddenOptionName = "hidden" onlyHashOptionName = "only-hash" chunkerOptionName = "chunker" pinOptionName = "pin" @@ -112,6 +112,8 @@ You can now check what blocks have been created by: Options: []cmdkit.Option{ cmds.OptionRecursivePath, // a builtin option that allows recursive paths (-r, --recursive) cmds.OptionDerefArgs, // a builtin option that resolves passed in filesystem links (--dereference-args) + cmds.OptionStdinName, // a builtin option that optionally allows wrapping stdin into a named file + cmds.OptionHidden, cmdkit.BoolOption(quietOptionName, "q", "Write minimal output."), cmdkit.BoolOption(quieterOptionName, "Q", "Write only final hash."), cmdkit.BoolOption(silentOptionName, "Write no output."), @@ -119,8 +121,6 @@ You can now check what blocks have been created by: cmdkit.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."), cmdkit.BoolOption(onlyHashOptionName, "n", "Only chunk and hash - do not write to disk."), cmdkit.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."), - cmdkit.StringOption(stdinPathName, "Assign a name if the file source is stdin."), - cmdkit.BoolOption(hiddenOptionName, "H", "Include files that are hidden. Only takes effect on recursive add."), cmdkit.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]").WithDefault("size-262144"), cmdkit.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true), cmdkit.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes. (experimental)"), @@ -160,7 +160,6 @@ You can now check what blocks have been created by: trickle, _ := req.Options[trickleOptionName].(bool) wrap, _ := req.Options[wrapOptionName].(bool) hash, _ := req.Options[onlyHashOptionName].(bool) - hidden, _ := req.Options[hiddenOptionName].(bool) silent, _ := req.Options[silentOptionName].(bool) chunker, _ := req.Options[chunkerOptionName].(string) dopin, _ := req.Options[pinOptionName].(bool) @@ -171,7 +170,6 @@ You can now check what blocks have been created by: hashFunStr, _ := req.Options[hashOptionName].(string) inline, _ := req.Options[inlineOptionName].(bool) inlineLimit, _ := req.Options[inlineLimitOptionName].(int) - pathName, _ := req.Options[stdinPathName].(string) hashFunCode, ok := mh.Names[strings.ToLower(hashFunStr)] if !ok { @@ -185,6 +183,23 @@ You can now check what blocks have been created by: events := make(chan interface{}, adderOutChanSize) + var toadd files.Node = req.Files + name := "" + if !wrap { + it := req.Files.Entries() + if !it.Next() { + err := it.Err() + if err == nil { + return fmt.Errorf("expected a file argument") + } + return err + } + + toadd = it.Node() + name = it.Name() + } + _, dir := toadd.(files.Directory) + opts := []options.UnixfsAddOption{ options.Unixfs.Hash(hashFunCode), @@ -198,10 +213,6 @@ You can now check what blocks have been created by: options.Unixfs.FsCache(fscache), options.Unixfs.Nocopy(nocopy), - options.Unixfs.Wrap(wrap), - options.Unixfs.Hidden(hidden), - options.Unixfs.StdinName(pathName), - options.Unixfs.Progress(progress), options.Unixfs.Silent(silent), options.Unixfs.Events(events), @@ -224,7 +235,7 @@ You can now check what blocks have been created by: var err error defer func() { errCh <- err }() defer close(events) - _, err = api.Unixfs().Add(req.Context, req.Files, opts...) + _, err = api.Unixfs().Add(req.Context, toadd, opts...) }() for event := range events { @@ -238,6 +249,12 @@ You can now check what blocks have been created by: h = enc.Encode(output.Path.Cid()) } + if !dir && name != "" { + output.Name = name + } else { + output.Name = path.Join(name, output.Name) + } + res.Emit(&AddEvent{ Name: output.Name, Hash: h, diff --git a/core/coreapi/unixfs.go b/core/coreapi/unixfs.go index c840280bb..ce0ecf8fe 100644 --- a/core/coreapi/unixfs.go +++ b/core/coreapi/unixfs.go @@ -87,13 +87,11 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options fileAdder.Out = settings.Events fileAdder.Progress = settings.Progress } - fileAdder.Hidden = settings.Hidden fileAdder.Wrap = settings.Wrap fileAdder.Pin = settings.Pin && !settings.OnlyHash fileAdder.Silent = settings.Silent fileAdder.RawLeaves = settings.RawLeaves fileAdder.NoCopy = settings.NoCopy - fileAdder.Name = settings.StdinName fileAdder.CidBuilder = prefix switch settings.Layout { diff --git a/core/corehttp/gateway_test.go b/core/corehttp/gateway_test.go index a2a77d1c5..b44f9ef4f 100644 --- a/core/corehttp/gateway_test.go +++ b/core/corehttp/gateway_test.go @@ -22,7 +22,6 @@ import ( files "github.com/ipfs/go-ipfs-files" path "github.com/ipfs/go-path" iface "github.com/ipfs/interface-go-ipfs-core" - "github.com/ipfs/interface-go-ipfs-core/options" nsopts "github.com/ipfs/interface-go-ipfs-core/options/namesys" ci "github.com/libp2p/go-libp2p-crypto" id "github.com/libp2p/go-libp2p/p2p/protocol/identify" @@ -253,7 +252,7 @@ func TestIPNSHostnameRedirect(t *testing.T) { }), }) - k, err := api.Unixfs().Add(ctx, f1, options.Unixfs.Wrap(true)) + k, err := api.Unixfs().Add(ctx, f1) if err != nil { t.Fatal(err) } @@ -346,7 +345,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) { }) // create /ipns/example.net/foo/ - k, err := api.Unixfs().Add(ctx, f1, options.Unixfs.Wrap(true)) + k, err := api.Unixfs().Add(ctx, f1) if err != nil { t.Fatal(err) } diff --git a/core/coreunix/add.go b/core/coreunix/add.go index ae84495f9..4fc749c06 100644 --- a/core/coreunix/add.go +++ b/core/coreunix/add.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "io" - "os" gopath "path" "strconv" @@ -50,7 +49,6 @@ func NewAdder(ctx context.Context, p pin.Pinner, bs bstore.GCLocker, ds ipld.DAG dagService: ds, bufferedDS: bufferedDS, Progress: false, - Hidden: true, Pin: true, Trickle: false, Wrap: false, @@ -67,13 +65,11 @@ type Adder struct { bufferedDS *ipld.BufferedDAG Out chan<- interface{} Progress bool - Hidden bool Pin bool Trickle bool RawLeaves bool Silent bool Wrap bool - Name string NoCopy bool Chunker string root ipld.Node @@ -132,8 +128,8 @@ func (adder *Adder) add(reader io.Reader) (ipld.Node, error) { return balanced.Layout(db) } -// RootNode returns the root node of the Added. -func (adder *Adder) RootNode() (ipld.Node, error) { +// RootNode returns the mfs root node +func (adder *Adder) curRootNode() (ipld.Node, error) { // for memoizing if adder.root != nil { return adder.root, nil @@ -164,18 +160,14 @@ func (adder *Adder) RootNode() (ipld.Node, error) { // Recursively pins the root node of Adder and // writes the pin state to the backing datastore. -func (adder *Adder) PinRoot() error { - root, err := adder.RootNode() - if err != nil { - return err - } +func (adder *Adder) PinRoot(root ipld.Node) error { if !adder.Pin { return nil } rnk := root.Cid() - err = adder.dagService.Add(adder.ctx, root) + err := adder.dagService.Add(adder.ctx, root) if err != nil { return err } @@ -192,53 +184,6 @@ func (adder *Adder) PinRoot() error { return adder.pinning.Flush() } -// Finalize flushes the mfs root directory and returns the mfs root node. -func (adder *Adder) Finalize() (ipld.Node, error) { - mr, err := adder.mfsRoot() - if err != nil { - return nil, err - } - var root mfs.FSNode - rootdir := mr.GetDirectory() - root = rootdir - - err = root.Flush() - if err != nil { - return nil, err - } - - var name string - if !adder.Wrap { - children, err := rootdir.ListNames(adder.ctx) - if err != nil { - return nil, err - } - - if len(children) == 0 { - return nil, fmt.Errorf("expected at least one child dir, got none") - } - - // Replace root with the first child - name = children[0] - root, err = rootdir.Child(name) - if err != nil { - return nil, err - } - } - - err = adder.outputDirs(name, root) - if err != nil { - return nil, err - } - - err = mr.Close() - if err != nil { - return nil, err - } - - return root.GetNode() -} - func (adder *Adder) outputDirs(path string, fsn mfs.FSNode) error { switch fsn := fsn.(type) { case *mfs.File: @@ -321,30 +266,77 @@ func (adder *Adder) AddAllAndPin(file files.Node) (ipld.Node, error) { } }() - switch tf := file.(type) { - case files.Directory: - // Iterate over each top-level file and add individually. Otherwise the - // single files.File f is treated as a directory, affecting hidden file - // semantics. - it := tf.Entries() - for it.Next() { - if err := adder.addFileNode(it.Name(), it.Node()); err != nil { - return nil, err - } - } - if it.Err() != nil { - return nil, it.Err() - } - break - default: - if err := adder.addFileNode("", file); err != nil { - return nil, err - } - break + if err := adder.addFileNode("", file, true); err != nil { + return nil, err } - // copy intermediary nodes from editor to our actual dagservice - nd, err := adder.Finalize() + // get root + mr, err := adder.mfsRoot() + if err != nil { + return nil, err + } + var root mfs.FSNode + rootdir := mr.GetDirectory() + root = rootdir + + err = root.Flush() + if err != nil { + return nil, err + } + + // if adding a file without wrapping, swap the root to it (when adding a + // directory, mfs root is the directory) + _, dir := file.(files.Directory) + var name string + if !adder.Wrap && !dir { + children, err := rootdir.ListNames(adder.ctx) + if err != nil { + return nil, err + } + + if len(children) == 0 { + return nil, fmt.Errorf("expected at least one child dir, got none") + } + + // Replace root with the first child + name = children[0] + root, err = rootdir.Child(name) + if err != nil { + return nil, err + } + } + + err = mr.Close() + if err != nil { + return nil, err + } + + nd, err := root.GetNode() + if err != nil { + return nil, err + } + + // when adding wrapped directory, manually wrap here + if adder.Wrap && dir { + name = nd.Cid().String() + + end := unixfs.EmptyDirNode() + if err := end.AddNodeLink(nd.Cid().String(), nd); err != nil { + return nil, err + } + nd = end + + if err := adder.dagService.Add(adder.ctx, end); err != nil { + return nil, err + } + + if err := outputDagnode(adder.Out, "", nd); err != nil { + return nil, err + } + } + + // output directory events + err = adder.outputDirs(name, root) if err != nil { return nil, err } @@ -352,11 +344,14 @@ func (adder *Adder) AddAllAndPin(file files.Node) (ipld.Node, error) { if !adder.Pin { return nd, nil } - return nd, adder.PinRoot() + return nd, adder.PinRoot(nd) } -func (adder *Adder) addFileNode(path string, file files.Node) error { - defer file.Close() +func (adder *Adder) addFileNode(path string, file files.Node, toplevel bool) error { + if !toplevel { + defer file.Close() + } + err := adder.maybePauseForGC() if err != nil { return err @@ -378,7 +373,7 @@ func (adder *Adder) addFileNode(path string, file files.Node) error { switch f := file.(type) { case files.Directory: - return adder.addDir(path, f) + return adder.addDir(path, f, toplevel) case *files.Symlink: return adder.addSymlink(path, f) case files.File: @@ -422,43 +417,32 @@ func (adder *Adder) addFile(path string, file files.File) error { return err } - addFileInfo, ok := file.(files.FileInfo) - if ok { - if addFileInfo.AbsPath() == os.Stdin.Name() && adder.Name != "" { - path = adder.Name - adder.Name = "" - } - } // patch it into the root return adder.addNode(dagnode, path) } -func (adder *Adder) addDir(path string, dir files.Directory) error { +func (adder *Adder) addDir(path string, dir files.Directory, toplevel bool) error { log.Infof("adding directory: %s", path) - mr, err := adder.mfsRoot() - if err != nil { - return err - } - err = mfs.Mkdir(mr, path, mfs.MkdirOpts{ - Mkparents: true, - Flush: false, - CidBuilder: adder.CidBuilder, - }) - if err != nil { - return err + if !(toplevel && path == "") { + mr, err := adder.mfsRoot() + if err != nil { + return err + } + err = mfs.Mkdir(mr, path, mfs.MkdirOpts{ + Mkparents: true, + Flush: false, + CidBuilder: adder.CidBuilder, + }) + if err != nil { + return err + } } it := dir.Entries() for it.Next() { fpath := gopath.Join(path, it.Name()) - - // Skip hidden files when adding recursively, unless Hidden is enabled. - if files.IsHidden(fpath, it.Node()) && !adder.Hidden { - log.Infof("%s is hidden, skipping", fpath) - continue - } - err = adder.addFileNode(fpath, it.Node()) + err := adder.addFileNode(fpath, it.Node(), false) if err != nil { return err } @@ -469,7 +453,12 @@ func (adder *Adder) addDir(path string, dir files.Directory) error { func (adder *Adder) maybePauseForGC() error { if adder.unlocker != nil && adder.gcLocker.GCRequested() { - err := adder.PinRoot() + rn, err := adder.curRootNode() + if err != nil { + return err + } + + err = adder.PinRoot(rn) if err != nil { return err } diff --git a/go.mod b/go.mod index 559c141bb..a4a9f9c55 100644 --- a/go.mod +++ b/go.mod @@ -32,12 +32,12 @@ require ( github.com/ipfs/go-ipfs-blocksutil v0.0.1 github.com/ipfs/go-ipfs-chunker v0.0.1 github.com/ipfs/go-ipfs-cmdkit v0.0.1 - github.com/ipfs/go-ipfs-cmds v0.0.2 + github.com/ipfs/go-ipfs-cmds v0.0.4 github.com/ipfs/go-ipfs-config v0.0.1 github.com/ipfs/go-ipfs-ds-help v0.0.1 github.com/ipfs/go-ipfs-exchange-interface v0.0.1 github.com/ipfs/go-ipfs-exchange-offline v0.0.1 - github.com/ipfs/go-ipfs-files v0.0.1 + github.com/ipfs/go-ipfs-files v0.0.2 github.com/ipfs/go-ipfs-posinfo v0.0.1 github.com/ipfs/go-ipfs-routing v0.0.1 github.com/ipfs/go-ipfs-util v0.0.1 @@ -54,7 +54,7 @@ require ( github.com/ipfs/go-unixfs v0.0.3 github.com/ipfs/go-verifcid v0.0.1 github.com/ipfs/hang-fds v0.0.1 - github.com/ipfs/interface-go-ipfs-core v0.0.3 + github.com/ipfs/interface-go-ipfs-core v0.0.4 github.com/ipfs/iptb v1.4.0 github.com/ipfs/iptb-plugins v0.0.2 github.com/jbenet/go-is-domain v1.0.2 @@ -108,6 +108,7 @@ require ( github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 + golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e // indirect gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect gopkg.in/cheggaaa/pb.v1 v1.0.28 gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect diff --git a/go.sum b/go.sum index a96d57f5e..0fb3221bc 100644 --- a/go.sum +++ b/go.sum @@ -143,8 +143,10 @@ github.com/ipfs/go-ipfs-chunker v0.0.1 h1:cHUUxKFQ99pozdahi+uSC/3Y6HeRpi9oTeUHbE github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw= github.com/ipfs/go-ipfs-cmdkit v0.0.1 h1:X6YXEAjUljTzevE6DPUKXSqcgf+4FXzcn5B957F5MXo= github.com/ipfs/go-ipfs-cmdkit v0.0.1/go.mod h1:9FtbMdUabcSqv/G4/8WCxSLxkZxn/aZEFrxxqnVcRbg= -github.com/ipfs/go-ipfs-cmds v0.0.2 h1:wbyUvMGAsQLz8KUeYLK+Q6vX1MStR51O3a3vsgtf/Pk= -github.com/ipfs/go-ipfs-cmds v0.0.2/go.mod h1:k7I8PptE2kCJchR3ta546LRyxl4/uBYbLQHOJM0sUQ8= +github.com/ipfs/go-ipfs-cmds v0.0.3 h1:QvNUE8lslNQghxXf6vzV1ZoMQCDDAtKG8f2oINiRew4= +github.com/ipfs/go-ipfs-cmds v0.0.3/go.mod h1:1QVgxSgenZvOMGVC/XUTC7tJxRBGPLxYvpgPpCi3DUk= +github.com/ipfs/go-ipfs-cmds v0.0.4 h1:Iq4I8irWw5TmHe/4pjSyYJLbYkkdMOgHVe8ofJmPa4k= +github.com/ipfs/go-ipfs-cmds v0.0.4/go.mod h1:1QVgxSgenZvOMGVC/XUTC7tJxRBGPLxYvpgPpCi3DUk= github.com/ipfs/go-ipfs-config v0.0.1 h1:6ED08emzI1imdsAjixFi2pEyZxTVD5ECKtCOxLBx+Uc= github.com/ipfs/go-ipfs-config v0.0.1/go.mod h1:KDbHjNyg4e6LLQSQpkgQMBz6Jf4LXiWAcmnkcwmH0DU= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= @@ -158,6 +160,8 @@ github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= github.com/ipfs/go-ipfs-files v0.0.1 h1:OroTsI58plHGX70HPLKy6LQhPR3HZJ5ip61fYlo6POM= github.com/ipfs/go-ipfs-files v0.0.1/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= +github.com/ipfs/go-ipfs-files v0.0.2 h1:fEEjF4H+1t8SFOHqUGp0KqcwgIRlbD2bu8CAS2sIggE= +github.com/ipfs/go-ipfs-files v0.0.2/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-flags v0.0.1 h1:OH5cEkJYL0QgA+bvD55TNG9ud8HA2Nqaav47b2c/UJk= github.com/ipfs/go-ipfs-flags v0.0.1/go.mod h1:RnXBb9WV53GSfTrSDVK61NLTFKvWc60n+K9EgCDh+rA= github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= @@ -202,8 +206,8 @@ github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2 github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= github.com/ipfs/hang-fds v0.0.1 h1:KGAxiGtJPT3THVRNT6yxgpdFPeX4ZemUjENOt6NlOn4= github.com/ipfs/hang-fds v0.0.1/go.mod h1:U4JNbzwTpk/qP2Ms4VgrZ4HcgJGVosBJqMXvwe4udSY= -github.com/ipfs/interface-go-ipfs-core v0.0.3 h1:d/gYlvojMzi/uG6ixd/v4XN8ZYy3Mdil13+rLg7k7Qs= -github.com/ipfs/interface-go-ipfs-core v0.0.3/go.mod h1:CbFOGVGV8B4NCA0fAO2VVZ1Jt/ZQYE3FzTC6nLVqiAE= +github.com/ipfs/interface-go-ipfs-core v0.0.4 h1:bMsRGLkttV8Y5C1VyeSePVxEatRGwS9pRdhNkWOt+cY= +github.com/ipfs/interface-go-ipfs-core v0.0.4/go.mod h1:AOUhAfBqYu3G6Ocn+Y6rgWUWjp2zdPZiCLr8QS1TEKg= github.com/ipfs/iptb v1.4.0 h1:YFYTrCkLMRwk/35IMyC6+yjoQSHTEcNcefBStLJzgvo= github.com/ipfs/iptb v1.4.0/go.mod h1:1rzHpCYtNp87/+hTxG5TfCVn/yMY3dKnLn8tBiMfdmg= github.com/ipfs/iptb-plugins v0.0.2 h1:JZp4h/+7f00dY4Epr8gzF+VqKITXmVGsZabvmZp7E9I= @@ -503,6 +507,8 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635 h1:2eB4G6bDQDeP69ZXbOKC00S2Kf6TIiRS+DzfKsKeQU0= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3 h1:P6iTFmrTQqWrqLZPX1VMzCUbCRCAUXSUsSpkEOvWzJ0= golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/package.json b/package.json index 659cc6206..181cd09aa 100644 --- a/package.json +++ b/package.json @@ -295,9 +295,9 @@ "version": "3.0.35" }, { - "hash": "Qmf46mr235gtyxizkKUkTH5fo62Thza2zwXR4DWC7rkoqF", + "hash": "QmdTtHdShUivytzKHVuTM7fnxn6Qv1UUX49gjxg3DzjYXz", "name": "go-ipfs-cmds", - "version": "2.0.19" + "version": "2.0.21" }, { "hash": "Qmde5VP1qUkyQXKCfmEUA7bP64V2HAptbJ7phuPp7jXWwg", @@ -513,9 +513,9 @@ }, { "author": "why", - "hash": "QmPbePTPStDY8fau3PvN1bUwy47w9K4J5EnKj5ELEgitPC", + "hash": "QmVmueix5wxmr8UWpfpcKw6F1xT7T8AS7CXQRM37BE29eX", "name": "go-unixfs", - "version": "1.3.14" + "version": "1.3.15" }, { "author": "magik6k", @@ -531,9 +531,9 @@ }, { "author": "hsanjuan", - "hash": "QmZgdW4wnFRryGicyQVcVyXFjnnTqSpbtjQjuKbucaSwq8", + "hash": "QmNQtvcJon7xo5V8DMn6MEKMFMCeXnKUNdtGC2NwGYkqk1", "name": "go-mfs", - "version": "0.1.53" + "version": "0.1.54" }, { "author": "kevina", @@ -578,9 +578,9 @@ }, { "author": "magik6k", - "hash": "QmQmhotPUzVrMEWNK3x1R5jQ5ZHWyL7tVUrmRPjrBrvyCb", + "hash": "QmRHcZ5ngUxZo8phLR3fpoqk9wA7VdGc5mhwkGSnB2nZ9F", "name": "go-ipfs-files", - "version": "2.0.6" + "version": "2.0.7" }, { "author": "whyrusleeping", @@ -608,9 +608,9 @@ }, { "author": "magik6k", - "hash": "QmaRXSjk41fN4sVxGrtNyBP5eGYYM7GydPziYEPNc5Wvcr", + "hash": "QmaLFN7mZFjJ1W9aQiPoY2WySnSqphmfZHQCPUtj2iqWVH", "name": "interface-go-ipfs-core", - "version": "0.1.14" + "version": "0.1.15" } ], "gxVersion": "0.10.0", diff --git a/test/sharness/t0080-repo.sh b/test/sharness/t0080-repo.sh index 8fe118edd..2882e8721 100755 --- a/test/sharness/t0080-repo.sh +++ b/test/sharness/t0080-repo.sh @@ -30,8 +30,7 @@ test_expect_success "'ipfs repo gc' succeeds" ' ' test_expect_success "'ipfs repo gc' looks good (patch root)" ' - PATCH_ROOT=QmQXirSbubiySKnqaFyfs5YzziXRB5JEVQVjU6xsd7innr && - grep "removed $PATCH_ROOT" gc_out_actual + grep -v "removed $HASH" gc_out_actual ' test_expect_success "'ipfs repo gc' doesnt remove file" ' @@ -113,8 +112,7 @@ test_expect_success "remove direct pin" ' test_expect_success "'ipfs repo gc' removes file" ' ipfs repo gc >actual7 && - grep "removed $HASH" actual7 && - grep "removed $PATCH_ROOT" actual7 + grep "removed $HASH" actual7 ' test_expect_success "'ipfs refs local' no longer shows file" ' @@ -123,8 +121,7 @@ test_expect_success "'ipfs refs local' no longer shows file" ' grep "QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y" actual8 && grep "$EMPTY_DIR" actual8 && grep "$HASH_WELCOME_DOCS" actual8 && - test_must_fail grep "$HASH" actual8 && - test_must_fail grep "$PATCH_ROOT" actual8 + test_must_fail grep "$HASH" actual8 ' test_expect_success "adding multiblock random file succeeds" ' diff --git a/test/sharness/t0175-reprovider.sh b/test/sharness/t0175-reprovider.sh index 6a30dfb44..2df63fdfc 100755 --- a/test/sharness/t0175-reprovider.sh +++ b/test/sharness/t0175-reprovider.sh @@ -75,9 +75,9 @@ test_expect_success 'prepare test files' ' ' test_expect_success 'add test objects' ' - HASH_FOO=$(ipfsi 0 add -q --local --pin=false f1) && - HASH_BAR=$(ipfsi 0 add -q --local --pin=false f2) && - HASH_BAR_DIR=$(ipfsi 0 add -q --local -w f2) + HASH_FOO=$(ipfsi 0 add -q --offline --pin=false f1) && + HASH_BAR=$(ipfsi 0 add -q --offline --pin=false f2) && + HASH_BAR_DIR=$(ipfsi 0 add -q --offline -w f2) ' findprovs_empty '$HASH_FOO' @@ -104,10 +104,10 @@ test_expect_success 'prepare test files' ' ' test_expect_success 'add test objects' ' - HASH_FOO=$(ipfsi 0 add -q --local --pin=false f1) && - HASH_BAR=$(ipfsi 0 add -q --local --pin=false f2) && - HASH_BAZ=$(ipfsi 0 add -q --local f3) && - HASH_BAR_DIR=$(ipfsi 0 add -q --local -w f2 | tail -1) + HASH_FOO=$(ipfsi 0 add -q --offline --pin=false f1) && + HASH_BAR=$(ipfsi 0 add -q --offline --pin=false f2) && + HASH_BAZ=$(ipfsi 0 add -q --offline f3) && + HASH_BAR_DIR=$(ipfsi 0 add -q --offline -w f2 | tail -1) ' findprovs_empty '$HASH_FOO' @@ -142,7 +142,7 @@ test_expect_success 'Disable reprovider ticking' ' startup_cluster ${NUM_NODES} test_expect_success 'add test object' ' - HASH_0=$(echo "foo" | ipfsi 0 add -q --local) + HASH_0=$(echo "foo" | ipfsi 0 add -q --offline) ' findprovs_empty '$HASH_0'