-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(files): add slash for dir #5605
Conversation
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
@schomatis I add the slash for dir when using |
Yes, we can later evaluate adding it for both cases if you feel like it, but this seems like an inexpensive first approach. |
Could you add a test case for it? (Or modify the existing ones, I'm not sure if this change will break them, we sometimes check with |
@schomatis I had added the test case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
test/sharness/t0250-files-api.sh
Outdated
@@ -260,6 +260,12 @@ test_files_api() { | |||
verify_dir_contents /cats/this/is/a/dir | |||
' | |||
|
|||
test_expect_success "dir has correct name" ' | |||
echo "this/" > ls_dir_expected && | |||
ipfs files ls -l /cats | grep this/ | awk '\''{print $1}'\'' > ls_dir_actual && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the standard way is to output "filename hash size" in the ls_dir_actual
instead of using awk
+grep
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schomatis yeah, I also think that "filename hash size" is a better way. However, the hash
is unfixed, because ipfs files mkdir
uses different arg
:
https://github.com/ipfs/go-ipfs/blob/9bf4e4145ea897ced2f9aa2087296b3beda6e941/test/sharness/t0250-files-api.sh#L109-L116
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should then save the dir hash generated on every call, although I'm not sure if that's the best approach, @magik6k WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, we should grab the generated hash, save it and compare that
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
89574c8
to
ec8e451
Compare
@schomatis @magik6k I had modified the test case. |
Fixes: #5601
License: MIT
Signed-off-by: Overbool overbool.xu@gmail.com