@cryptotaxi247 / kubo / commits / 798afedf8

Make --hash and related option local to sub-commands that use them.

License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>

Kevin Atkinson committed Oct 19, 2017 at 11:53 UTC 798afedf8d11af78baeb5bfd50e028d8bd33d04f
2 files changed +105 -93
core/commands/files/files.go
+23 -12
@@ -41,21 +41,10 @@ of consistency guarantees. If the daemon is unexpectedly killed before running
41 'ipfs files flush' on the files in question, then data may be lost. This also
42 applies to running 'ipfs repo gc' concurrently with '--flush=false'
43 operations.
44 -
45 -The --cid-version and --hash-fun option only apply to newly created files
46 -and directories. If not specified these proprieties are inhertied
47 -from the parent directory.
44 `,
45 },
46 Options: []cmds.Option{
47 cmds.BoolOption("f", "flush", "Flush target and ancestors after write.").Default(true),
52 - cmds.BoolOption("raw-leaves", "Use raw blocks for newly created leaf nodes. (experimental)"),
53 - cmds.IntOption("cid-version", "cid-ver", "Cid version. Non-zero value will change default of 'raw-leaves' to true. (experimental)"),
54 - cmds.StringOption("hash-fun", "Hash function to use. Will set Cid version to 1 if used. (experimental)"),
55 - // ^^fixme: can't use just "hash" as the option name as the
56 - // conflicts with "--hash" usage by the stat command, this is
57 - // unfortunate as it creates an inconsistency with the "add"
58 - // that uses "hash"
48 },
49 Subcommands: map[string]*cmds.Command{
50 "read": FilesReadCmd,
@@ -71,6 +60,9 @@ from the parent directory.
60 },
61 }
62
63 +var cidVersionOption = cmds.IntOption("cid-version", "cid-ver", "Cid version to use. (experimental)")
64 +var hashOption = cmds.StringOption("hash", "Hash function to use. Will set Cid version to 1 if used. (experimental)")
65 +
66 var formatError = errors.New("Format was set by multiple options. Only one format option is allowed")
67
68 var FilesStatCmd = &cmds.Command{
@@ -576,6 +568,13 @@ a beginning offset to write to. The entire length of the input will be written.
568 If the '--create' option is specified, the file will be created if it does not
569 exist. Nonexistant intermediate directories will not be created.
570
571 +Newly created files will have the same CID version and hash function of the
572 +parent directory unless the --cid-version and --hash options are used.
573 +
574 +Newly created leaves will be in the legacy format (Protobuf) if the
575 +CID version is 0, or raw is the CID version is non-zero. Use of the
576 +--raw-leaves option will override this behavior.
577 +
578 If the '--flush' option is set to false, changes will not be propogated to the
579 merkledag root. This can make operations much faster when doing a large number
580 of writes to a deeper directory structure.
@@ -601,6 +600,9 @@ stat' on the file or any of its ancestors.
600 cmds.BoolOption("create", "e", "Create the file if it does not exist."),
601 cmds.BoolOption("truncate", "t", "Truncate the file to size zero before writing."),
602 cmds.IntOption("count", "n", "Maximum number of bytes to read."),
603 + cmds.BoolOption("raw-leaves", "Use raw blocks for newly created leaf nodes. (experimental)"),
604 + cidVersionOption,
605 + hashOption,
606 },
607 Run: func(req cmds.Request, res cmds.Response) {
608 path, err := checkPath(req.Arguments()[0])
@@ -709,6 +711,9 @@ var FilesMkdirCmd = &cmds.Command{
711 ShortDescription: `
712 Create the directory if it does not already exist.
713
714 +The directory will have the same CID version and hash function of the
715 +parent directory unless the --cid-version and --hash options are used.
716 +
717 NOTE: All paths must be absolute.
718
719 Examples:
@@ -723,6 +728,8 @@ Examples:
728 },
729 Options: []cmds.Option{
730 cmds.BoolOption("parents", "p", "No error if existing, make parent directories as needed."),
731 + cidVersionOption,
732 + hashOption,
733 },
734 Run: func(req cmds.Request, res cmds.Response) {
735 n, err := req.InvocContext().GetNode()
@@ -801,6 +808,10 @@ Change the cid version or hash function of the root node of a given path.
808 Arguments: []cmds.Argument{
809 cmds.StringArg("path", false, false, "Path to change. Default: '/'."),
810 },
811 + Options: []cmds.Option{
812 + cidVersionOption,
813 + hashOption,
814 + },
815 Run: func(req cmds.Request, res cmds.Response) {
816 nd, err := req.InvocContext().GetNode()
817 if err != nil {
@@ -959,7 +970,7 @@ Remove files or directories.
970
971 func getPrefix(req cmds.Request) (*cid.Prefix, error) {
972 cidVer, cidVerSet, _ := req.Option("cid-version").Int()
962 - hashFunStr, hashFunSet, _ := req.Option("hash-fun").String()
973 + hashFunStr, hashFunSet, _ := req.Option("hash").String()
974
975 if !cidVerSet && !hashFunSet {
976 return nil, nil
test/sharness/t0250-files-api.sh
+82 -81
@@ -51,7 +51,7 @@ test_sharding() {
51 ARGS=$2 # only applied to the initial directory
52
53 test_expect_success "make a directory $EXTRA" '
54 - ipfs files $ARGS mkdir /foo
54 + ipfs files mkdir $ARGS /foo
55 '
56
57 test_expect_success "can make 100 files in a directory $EXTRA" '
@@ -97,16 +97,17 @@ test_sharding() {
97 }
98
99 test_files_api() {
100 - local EXTRA ARGS
100 + local EXTRA ARGS RAW_LEAVES
101 EXTRA=$1
102 ARGS=$2
103 + RAW_LEAVES=$3
104
105 test_expect_success "can mkdir in root $EXTRA" '
105 - ipfs files $ARGS mkdir /cats
106 + ipfs files mkdir $ARGS /cats
107 '
108
109 test_expect_success "'files ls' lists root by default $EXTRA" '
109 - ipfs files $ARGS ls >actual &&
110 + ipfs files ls >actual &&
111 echo "cats" >expected &&
112 test_cmp expected actual
113 '
@@ -121,7 +122,7 @@ test_files_api() {
122 # we do verification of stat formatting now as we depend on it
123
124 test_expect_success "stat works $EXTRA" '
124 - ipfs files $ARGS stat / >stat
125 + ipfs files stat / >stat
126 '
127
128 test_expect_success "hash is first line of stat $EXTRA" '
@@ -129,41 +130,41 @@ test_files_api() {
130 '
131
132 test_expect_success "stat --hash gives only hash $EXTRA" '
132 - ipfs files $ARGS stat --hash / >actual &&
133 + ipfs files stat --hash / >actual &&
134 head -n1 stat >expected &&
135 test_cmp expected actual
136 '
137
138 test_expect_success "stat with multiple format options should fail $EXTRA" '
138 - test_must_fail ipfs files $ARGS stat --hash --size /
139 + test_must_fail ipfs files stat --hash --size /
140 '
141
142 test_expect_success "compare hash option with format $EXTRA" '
142 - ipfs files $ARGS stat --hash / >expected &&
143 - ipfs files $ARGS stat --format='"'"'<hash>'"'"' / >actual &&
143 + ipfs files stat --hash / >expected &&
144 + ipfs files stat --format='"'"'<hash>'"'"' / >actual &&
145 test_cmp expected actual
146 '
147 test_expect_success "compare size option with format $EXTRA" '
147 - ipfs files $ARGS stat --size / >expected &&
148 - ipfs files $ARGS stat --format='"'"'<cumulsize>'"'"' / >actual &&
148 + ipfs files stat --size / >expected &&
149 + ipfs files stat --format='"'"'<cumulsize>'"'"' / >actual &&
150 test_cmp expected actual
151 '
152
153 test_expect_success "check root hash $EXTRA" '
153 - ipfs files $ARGS stat --hash / > roothash
154 + ipfs files stat --hash / > roothash
155 '
156
157 test_expect_success "cannot mkdir / $EXTRA" '
157 - test_expect_code 1 ipfs files $ARGS mkdir /
158 + test_expect_code 1 ipfs files mkdir $ARGS /
159 '
160
161 test_expect_success "check root hash was not changed $EXTRA" '
161 - ipfs files $ARGS stat --hash / > roothashafter &&
162 + ipfs files stat --hash / > roothashafter &&
163 test_cmp roothash roothashafter
164 '
165
166 test_expect_success "can put files into directory $EXTRA" '
166 - ipfs files $ARGS cp /ipfs/$FILE1 /cats/file1
167 + ipfs files cp /ipfs/$FILE1 /cats/file1
168 '
169
170 test_expect_success "file shows up in directory $EXTRA" '
@@ -172,12 +173,12 @@ test_files_api() {
173
174 test_expect_success "file has correct hash and size in directory $EXTRA" '
175 echo "file1 $FILE1 4" > ls_l_expected &&
175 - ipfs files $ARGS ls -l /cats > ls_l_actual &&
176 + ipfs files ls -l /cats > ls_l_actual &&
177 test_cmp ls_l_expected ls_l_actual
178 '
179
180 test_expect_success "can read file $EXTRA" '
180 - ipfs files $ARGS read /cats/file1 > file1out
181 + ipfs files read /cats/file1 > file1out
182 '
183
184 test_expect_success "output looks good $EXTRA" '
@@ -186,7 +187,7 @@ test_files_api() {
187 '
188
189 test_expect_success "can put another file into root $EXTRA" '
189 - ipfs files $ARGS cp /ipfs/$FILE2 /file2
190 + ipfs files cp /ipfs/$FILE2 /file2
191 '
192
193 test_expect_success "file shows up in root $EXTRA" '
@@ -194,7 +195,7 @@ test_files_api() {
195 '
196
197 test_expect_success "can read file $EXTRA" '
197 - ipfs files $ARGS read /file2 > file2out
198 + ipfs files read /file2 > file2out
199 '
200
201 test_expect_success "output looks good $EXTRA" '
@@ -203,7 +204,7 @@ test_files_api() {
204 '
205
206 test_expect_success "can make deep directory $EXTRA" '
206 - ipfs files $ARGS mkdir -p /cats/this/is/a/dir
207 + ipfs files mkdir $ARGS -p /cats/this/is/a/dir
208 '
209
210 test_expect_success "directory was created correctly $EXTRA" '
@@ -216,11 +217,11 @@ test_files_api() {
217 '
218
219 test_expect_success "can copy file into new dir $EXTRA" '
219 - ipfs files $ARGS cp /ipfs/$FILE3 /cats/this/is/a/dir/file3
220 + ipfs files cp /ipfs/$FILE3 /cats/this/is/a/dir/file3
221 '
222
223 test_expect_success "can read file $EXTRA" '
223 - ipfs files $ARGS read /cats/this/is/a/dir/file3 > output
224 + ipfs files read /cats/this/is/a/dir/file3 > output
225 '
226
227 test_expect_success "output looks good $EXTRA" '
@@ -233,7 +234,7 @@ test_files_api() {
234 '
235
236 test_expect_success "can remove file $EXTRA" '
236 - ipfs files $ARGS rm /cats/this/is/a/dir/file3
237 + ipfs files rm /cats/this/is/a/dir/file3
238 '
239
240 test_expect_success "file no longer appears $EXTRA" '
@@ -241,7 +242,7 @@ test_files_api() {
242 '
243
244 test_expect_success "can remove dir $EXTRA" '
244 - ipfs files $ARGS rm -r /cats/this/is/a/dir
245 + ipfs files rm -r /cats/this/is/a/dir
246 '
247
248 test_expect_success "dir no longer appears $EXTRA" '
@@ -249,7 +250,7 @@ test_files_api() {
250 '
251
252 test_expect_success "can remove file from root $EXTRA" '
252 - ipfs files $ARGS rm /file2
253 + ipfs files rm /file2
254 '
255
256 test_expect_success "file no longer appears $EXTRA" '
@@ -257,22 +258,22 @@ test_files_api() {
258 '
259
260 test_expect_success "check root hash $EXTRA" '
260 - ipfs files $ARGS stat --hash / > roothash
261 + ipfs files stat --hash / > roothash
262 '
263
264 test_expect_success "cannot remove root $EXTRA" '
264 - test_expect_code 1 ipfs files $ARGS rm -r /
265 + test_expect_code 1 ipfs files rm -r /
266 '
267
268 test_expect_success "check root hash was not changed $EXTRA" '
268 - ipfs files $ARGS stat --hash / > roothashafter &&
269 + ipfs files stat --hash / > roothashafter &&
270 test_cmp roothash roothashafter
271 '
272
273 # test read options
274
275 test_expect_success "read from offset works $EXTRA" '
275 - ipfs files $ARGS read -o 1 /cats/file1 > output
276 + ipfs files read -o 1 /cats/file1 > output
277 '
278
279 test_expect_success "output looks good $EXTRA" '
@@ -281,7 +282,7 @@ test_files_api() {
282 '
283
284 test_expect_success "read with size works $EXTRA" '
284 - ipfs files $ARGS read -n 2 /cats/file1 > output
285 + ipfs files read -n 2 /cats/file1 > output
286 '
287
288 test_expect_success "output looks good $EXTRA" '
@@ -290,11 +291,11 @@ test_files_api() {
291 '
292
293 test_expect_success "cannot read from negative offset $EXTRA" '
293 - test_expect_code 1 ipfs files $ARGS read --offset -3 /cats/file1
294 + test_expect_code 1 ipfs files read --offset -3 /cats/file1
295 '
296
297 test_expect_success "read from offset 0 works $EXTRA" '
297 - ipfs files $ARGS read --offset 0 /cats/file1 > output
298 + ipfs files read --offset 0 /cats/file1 > output
299 '
300
301 test_expect_success "output looks good $EXTRA" '
@@ -303,7 +304,7 @@ test_files_api() {
304 '
305
306 test_expect_success "read last byte works $EXTRA" '
306 - ipfs files $ARGS read --offset 2 /cats/file1 > output
307 + ipfs files read --offset 2 /cats/file1 > output
308 '
309
310 test_expect_success "output looks good $EXTRA" '
@@ -312,7 +313,7 @@ test_files_api() {
313 '
314
315 test_expect_success "offset past end of file fails $EXTRA" '
315 - test_expect_code 1 ipfs files $ARGS read --offset 5 /cats/file1
316 + test_expect_code 1 ipfs files read --offset 5 /cats/file1
317 '
318
319 test_expect_success "cannot read negative count bytes $EXTRA" '
@@ -320,7 +321,7 @@ test_files_api() {
321 '
322
323 test_expect_success "reading zero bytes prints nothing $EXTRA" '
323 - ipfs files $ARGS read --count 0 /cats/file1 > output
324 + ipfs files read --count 0 /cats/file1 > output
325 '
326
327 test_expect_success "output looks good $EXTRA" '
@@ -329,7 +330,7 @@ test_files_api() {
330 '
331
332 test_expect_success "count > len(file) prints entire file $EXTRA" '
332 - ipfs files $ARGS read --count 200 /cats/file1 > output
333 + ipfs files read --count 200 /cats/file1 > output
334 '
335
336 test_expect_success "output looks good $EXTRA" '
@@ -341,7 +342,7 @@ test_files_api() {
342
343 test_expect_success "can write file $EXTRA" '
344 echo "ipfs rocks" > tmpfile &&
344 - cat tmpfile | ipfs files $ARGS write --create /cats/ipfs
345 + cat tmpfile | ipfs files write $ARGS $RAW_LEAVES --create /cats/ipfs
346 '
347
348 test_expect_success "file was created $EXTRA" '
@@ -349,44 +350,44 @@ test_files_api() {
350 '
351
352 test_expect_success "can read file we just wrote $EXTRA" '
352 - ipfs files $ARGS read /cats/ipfs > output
353 + ipfs files read /cats/ipfs > output
354 '
355
356 test_expect_success "can write to offset $EXTRA" '
356 - echo "is super cool" | ipfs files $ARGS write -o 5 /cats/ipfs
357 + echo "is super cool" | ipfs files write $ARGS $RAW_LEAVES -o 5 /cats/ipfs
358 '
359
360 test_expect_success "file looks correct $EXTRA" '
361 echo "ipfs is super cool" > expected &&
361 - ipfs files $ARGS read /cats/ipfs > output &&
362 + ipfs files read /cats/ipfs > output &&
363 test_cmp expected output
364 '
365
366 test_expect_success "file hash correct $EXTRA" '
367 echo $FILE_HASH > filehash_expected &&
367 - ipfs files $ARGS stat --hash /cats/ipfs > filehash &&
368 + ipfs files stat --hash /cats/ipfs > filehash &&
369 test_cmp filehash_expected filehash
370 '
371
372 test_expect_success "cant write to negative offset $EXTRA" '
372 - test_expect_code 1 ipfs files $ARGS write --offset -1 /cats/ipfs < output
373 + test_expect_code 1 ipfs files write $ARGS $RAW_LEAVES --offset -1 /cats/ipfs < output
374 '
375
376 test_expect_success "verify file was not changed $EXTRA" '
376 - ipfs files $ARGS stat --hash /cats/ipfs > afterhash &&
377 + ipfs files stat --hash /cats/ipfs > afterhash &&
378 test_cmp filehash afterhash
379 '
380
381 test_expect_success "write new file for testing $EXTRA" '
381 - echo foobar | ipfs files $ARGS write --create /fun
382 + echo foobar | ipfs files write $ARGS $RAW_LEAVES --create /fun
383 '
384
385 test_expect_success "write to offset past end works $EXTRA" '
385 - echo blah | ipfs files $ARGS write --offset 50 /fun
386 + echo blah | ipfs files write $ARGS $RAW_LEAVES --offset 50 /fun
387 '
388
389 test_expect_success "can read file $EXTRA" '
389 - ipfs files $ARGS read /fun > sparse_output
390 + ipfs files read /fun > sparse_output
391 '
392
393 test_expect_success "output looks good $EXTRA" '
@@ -396,21 +397,21 @@ test_files_api() {
397 '
398
399 test_expect_success "cleanup $EXTRA" '
399 - ipfs files $ARGS rm /fun
400 + ipfs files rm /fun
401 '
402
403 test_expect_success "cannot write to directory $EXTRA" '
403 - ipfs files $ARGS stat --hash /cats > dirhash &&
404 - test_expect_code 1 ipfs files $ARGS write /cats < output
404 + ipfs files stat --hash /cats > dirhash &&
405 + test_expect_code 1 ipfs files write $ARGS $RAW_LEAVES /cats < output
406 '
407
408 test_expect_success "verify dir was not changed $EXTRA" '
408 - ipfs files $ARGS stat --hash /cats > afterdirhash &&
409 + ipfs files stat --hash /cats > afterdirhash &&
410 test_cmp dirhash afterdirhash
411 '
412
413 test_expect_success "cannot write to nonexistant path $EXTRA" '
413 - test_expect_code 1 ipfs files $ARGS write /cats/bar/ < output
414 + test_expect_code 1 ipfs files write $ARGS $RAW_LEAVES /cats/bar/ < output
415 '
416
417 test_expect_success "no new paths were created $EXTRA" '
@@ -418,7 +419,7 @@ test_files_api() {
419 '
420
421 test_expect_success "write 'no-flush' succeeds $EXTRA" '
421 - echo "testing" | ipfs files $ARGS write -f=false -e /cats/walrus
422 + echo "testing" | ipfs files write $ARGS $RAW_LEAVES -f=false -e /cats/walrus
423 '
424
425 test_expect_success "root hash not bubbled up yet $EXTRA" '
@@ -428,7 +429,7 @@ test_files_api() {
429 '
430
431 test_expect_success "changes bubbled up to root on inspection $EXTRA" '
431 - ipfs files $ARGS stat --hash / > root_hash
432 + ipfs files stat --hash / > root_hash
433 '
434
435 test_expect_success "root hash looks good $EXTRA" '
@@ -445,12 +446,12 @@ test_files_api() {
446 '
447
448 test_expect_success "flush root succeeds $EXTRA" '
448 - ipfs files $ARGS flush /
449 + ipfs files flush /
450 '
451
452 # test mv
453 test_expect_success "can mv dir $EXTRA" '
453 - ipfs files $ARGS mv /cats/this/is /cats/
454 + ipfs files mv /cats/this/is /cats/
455 '
456
457 test_expect_success "mv worked $EXTRA" '
@@ -459,7 +460,7 @@ test_files_api() {
460 '
461
462 test_expect_success "cleanup, remove 'cats' $EXTRA" '
462 - ipfs files $ARGS rm -r /cats
463 + ipfs files rm -r /cats
464 '
465
466 test_expect_success "cleanup looks good $EXTRA" '
@@ -468,36 +469,36 @@ test_files_api() {
469
470 # test truncating
471 test_expect_success "create a new file $EXTRA" '
471 - echo "some content" | ipfs files $ARGS write --create /cats
472 + echo "some content" | ipfs files write $ARGS $RAW_LEAVES --create /cats
473 '
474
475 test_expect_success "truncate and write over that file $EXTRA" '
475 - echo "fish" | ipfs files $ARGS write --truncate /cats
476 + echo "fish" | ipfs files write $ARGS $RAW_LEAVES --truncate /cats
477 '
478
479 test_expect_success "output looks good $EXTRA" '
479 - ipfs files $ARGS read /cats > file_out &&
480 + ipfs files read /cats > file_out &&
481 echo "fish" > file_exp &&
482 test_cmp file_out file_exp
483 '
484
485 test_expect_success "file hash correct $EXTRA" '
486 echo $TRUNC_HASH > filehash_expected &&
486 - ipfs files $ARGS stat --hash /cats > filehash &&
487 + ipfs files stat --hash /cats > filehash &&
488 test_cmp filehash_expected filehash
489 '
490
491 test_expect_success "cleanup $EXTRA" '
491 - ipfs files $ARGS rm /cats
492 + ipfs files rm /cats
493 '
494
495 # test flush flags
496 test_expect_success "mkdir --flush works $EXTRA" '
496 - ipfs files $ARGS mkdir --flush --parents /flushed/deep
497 + ipfs files mkdir $ARGS --flush --parents /flushed/deep
498 '
499
500 test_expect_success "mkdir --flush works a second time $EXTRA" '
500 - ipfs files $ARGS mkdir --flush --parents /flushed/deep
501 + ipfs files mkdir $ARGS --flush --parents /flushed/deep
502 '
503
504 test_expect_success "dir looks right $EXTRA" '
@@ -509,7 +510,7 @@ test_files_api() {
510 '
511
512 test_expect_success "cleanup $EXTRA" '
512 - ipfs files $ARGS rm -r /flushed
513 + ipfs files rm -r /flushed
514 '
515
516 test_expect_success "child dir looks right $EXTRA" '
@@ -518,43 +519,43 @@ test_files_api() {
519
520 # test for https://github.com/ipfs/go-ipfs/issues/2654
521 test_expect_success "create and remove dir $EXTRA" '
521 - ipfs files $ARGS mkdir /test_dir &&
522 - ipfs files $ARGS rm -r "/test_dir"
522 + ipfs files mkdir $ARGS /test_dir &&
523 + ipfs files rm -r "/test_dir"
524 '
525
526 test_expect_success "create test file $EXTRA" '
526 - echo "content" | ipfs files $ARGS write -e "/test_file"
527 + echo "content" | ipfs files write $ARGS $RAW_LEAVES -e "/test_file"
528 '
529
530 test_expect_success "copy test file onto test dir $EXTRA" '
530 - ipfs files $ARGS cp "/test_file" "/test_dir"
531 + ipfs files cp "/test_file" "/test_dir"
532 '
533
534 test_expect_success "test /test_dir $EXTRA" '
534 - ipfs files $ARGS stat "/test_dir" | grep -q "^Type: file"
535 + ipfs files stat "/test_dir" | grep -q "^Type: file"
536 '
537
538 test_expect_success "clean up /test_dir and /test_file $EXTRA" '
538 - ipfs files $ARGS rm -r /test_dir &&
539 - ipfs files $ARGS rm -r /test_file
539 + ipfs files rm -r /test_dir &&
540 + ipfs files rm -r /test_file
541 '
542
543 test_expect_success "make a directory and a file $EXTRA" '
543 - ipfs files $ARGS mkdir /adir &&
544 - echo "blah" | ipfs files $ARGS write --create /foobar
544 + ipfs files mkdir $ARGS /adir &&
545 + echo "blah" | ipfs files write $ARGS $RAW_LEAVES --create /foobar
546 '
547
548 test_expect_success "copy a file into a directory $EXTRA" '
548 - ipfs files $ARGS cp /foobar /adir/
549 + ipfs files cp /foobar /adir/
550 '
551
552 test_expect_success "file made it into directory $EXTRA" '
552 - ipfs files $ARGS ls /adir | grep foobar
553 + ipfs files ls /adir | grep foobar
554 '
555
556 test_expect_success "clean up $EXTRA" '
556 - ipfs files $ARGS rm -r /foobar &&
557 - ipfs files $ARGS rm -r /adir
557 + ipfs files rm -r /foobar &&
558 + ipfs files rm -r /adir
559 '
560
561 test_expect_success "root mfs entry is empty $EXTRA" '
@@ -595,7 +596,7 @@ tests_for_files_api() {
596 CATS_HASH=QmPqWDEg7NoWRX8Y4vvYjZtmdg5umbfsTQ9zwNr12JoLmt
597 FILE_HASH=QmRCgHeoKxCqK2Es6M6nPUDVWz19yNQPnsXGsXeuTkSKpN
598 TRUNC_HASH=QmRFJEKWF5A5FyFYZgNhusLw2UziW9zBKYr4huyHjzcB6o
598 - test_files_api "($EXTRA, raw-leaves)" --raw-leaves
599 + test_files_api "($EXTRA, raw-leaves)" '' --raw-leaves
600
601 ROOT_HASH=QmageRWxC7wWjPv5p36NeAgBAiFdBHaNfxAehBSwzNech2
602 CATS_HASH=zdj7WkEzPLNAr5TYJSQC8CFcBjLvWFfGdx6kaBrJXnBguwWeX
@@ -606,7 +607,7 @@ tests_for_files_api() {
607 fi
608
609 test_expect_success "can update root hash to cidv1" '
609 - ipfs files --cid-version=1 chcid / &&
610 + ipfs files chcid --cid-version=1 / &&
611 echo zdj7WbTaiJT1fgatdet9Ei9iDB5hdCxkbVyhyh8YTUnXMiwYi > hash_expect &&
612 ipfs files stat --hash / > hash_actual &&
613 test_cmp hash_expect hash_actual
@@ -617,7 +618,7 @@ tests_for_files_api() {
618
619 if [ "$EXTRA" = "offline" ]; then
620 test_expect_success "can update root hash to blake2b-256" '
620 - ipfs files --hash-fun=blake2b-256 chcid / &&
621 + ipfs files chcid --hash=blake2b-256 / &&
622 echo zDMZof1kvswQMT8txrmnb3JGBuna6qXCTry6hSifrkZEd6VmHbBm > hash_expect &&
623 ipfs files stat --hash / > hash_actual &&
624 test_cmp hash_expect hash_actual
@@ -630,7 +631,7 @@ tests_for_files_api() {
631 fi
632
633 test_expect_success "can update root hash back to cidv0" '
633 - ipfs files --cid-version=0 chcid / &&
634 + ipfs files chcid / --cid-version=0 &&
635 echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn > hash_expect &&
636 ipfs files stat --hash / > hash_actual &&
637 test_cmp hash_expect hash_actual