Skip to content

Commit

Permalink
feat: default ipfs add to cidv1
Browse files Browse the repository at this point in the history
This is wip, purpose is to identify all tests that require refactor
  • Loading branch information
lidel committed Apr 7, 2022
1 parent 7871a0b commit 4a76f6e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/commands/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ only-hash, and progress/status related flags) will change the final hash.
cmds.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."),
cmds.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes], rabin-[min]-[avg]-[max] or buzhash").WithDefault("size-262144"),
cmds.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true),
cmds.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes."),
cmds.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes. (enabled for CIDv1)"),
cmds.BoolOption(noCopyOptionName, "Add the file using filestore. Implies raw-leaves. (experimental)"),
cmds.BoolOption(fstoreCacheOptionName, "Check the filestore for pre-existing blocks. (experimental)"),
cmds.IntOption(cidVersionOptionName, "CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. Passing version 1 will cause the raw-leaves option to default to true."),
cmds.IntOption(cidVersionOptionName, "CID version (default is 1)"),
cmds.StringOption(hashOptionName, "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)").WithDefault("sha2-256"),
cmds.BoolOption(inlineOptionName, "Inline small blocks into CIDs. (experimental)"),
cmds.IntOption(inlineLimitOptionName, "Maximum block size to inline. (experimental)").WithDefault(32),
Expand Down Expand Up @@ -217,6 +217,8 @@ only-hash, and progress/status related flags) will change the final hash.

if cidVerSet {
opts = append(opts, options.Unixfs.CidVersion(cidVer))
} else {
opts = append(opts, options.Unixfs.CidVersion(1))
}

if rbset {
Expand Down

0 comments on commit 4a76f6e

Please sign in to comment.