Open AuHau opened 4 years ago
I think this is meant to be a reflection of what happens in bash, etc.
Given:
foo
├── bar.txt
└── baz/
└── qux.txt
$ ls -l foo
total 3
-rw-r--r-- 8 alex staff 256 4 Oct 16:22 bar.txt
drwxr-xr-x 12 alex staff 384 8 Oct 11:52 baz
$ ls -lR foo
total 3
-rw-r--r-- 8 alex staff 256 4 Oct 16:22 bar.txt
drwxr-xr-x 12 alex staff 384 8 Oct 11:52 baz
foo/baz:
total 2
-rw-r--r-- 1 alex staff 838 20 May 15:44 qux.txt
In the second example the containing folder becomes part of the path - it prints foo/baz:
instead of baz:
.
That said, it'd certainly be simpler if it only worked one way, probably the second where the paths contain the CID
the user has specified.
For info: We agreed that the depth will be calculated as using full path. Hence when
/ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs
returns
Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs/contact
it will have depth 2.
As part of https://github.com/ipfs/js-ipfs/pull/2540 I was digging why there are different
link.depth
whenipfs ls
is called recursively and non-recursively. I have tracked the inconsistency to how this exporter returns paths when called recursively and non-recursively.When called using
/ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs
recursivelly, the result paths are:QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU/contact
QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU/about
When called using
/ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs
non-recursivelly, the result paths are:Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs/contact
Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs/about
Eq. the original
/init-docs
is suddenly part of the returned paths.I believe there should be one way for both ways. What should be the right one?