Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfs add -r -n does not output top/sub directories #2530

Closed
vitzli opened this issue Apr 6, 2016 · 3 comments
Closed

ipfs add -r -n does not output top/sub directories #2530

vitzli opened this issue Apr 6, 2016 · 3 comments

Comments

@vitzli
Copy link
Contributor

vitzli commented Apr 6, 2016

Current version of ipfs (0.4.0-dev) built from source, go 1.6, built on Debian Stretch amd64, running on Debian Jessie amd64

ipfs add -r -n does not output either top or subdirectories when the command is executed on directory, while ipfs add -r works.

script:

#!/bin/bash

if [ ! -d ipfstest ]; then
  mkdir -p ipfstest/{a,b}
fi

for x in 1 2 3
do
  dd if=/dev/urandom of=ipfstest/a/file${x}.bin bs=256K count=16 > /dev/null 2>&1
  dd if=/dev/urandom of=ipfstest/b/file${x}.bin bs=256K count=16 > /dev/null 2>&1
done

echo "Hash only:"
ipfs add -r -n ipfstest

echo "Hash and add blocks"
ipfs add -r ipfstest

output:

Hash only:
added QmZxW8y3nP1ugNtxKugFp2SB1teEEVcW1GysMvrTMXmuYk ipfstest/a/file1.bin
added QmWkXa5sheTRhitymrJHvkuMFaPtKcg5Nt6JzyNswAgRnS ipfstest/a/file2.bin
added QmZjJYfbsY1a2BjKcWT4CSt8z9sCtyWXvmaQGPrydXjCgt ipfstest/a/file3.bin
added QmSpazKEYebnp45FPDrggMTWGu9KLcLutsnaK8qVWidLBz ipfstest/b/file1.bin
added QmYAi78t3tp3Ajtiqih4HXGRyd2yuH9FPZKj9PfzrxbmhP ipfstest/b/file2.bin
added QmZaq1e5RXNpmn3DoV3B3eocSeUqWjVKUSeYZcReAtwCyd ipfstest/b/file3.bin
Hash and add blocks
added QmZxW8y3nP1ugNtxKugFp2SB1teEEVcW1GysMvrTMXmuYk ipfstest/a/file1.bin
added QmWkXa5sheTRhitymrJHvkuMFaPtKcg5Nt6JzyNswAgRnS ipfstest/a/file2.bin
added QmZjJYfbsY1a2BjKcWT4CSt8z9sCtyWXvmaQGPrydXjCgt ipfstest/a/file3.bin
added QmSpazKEYebnp45FPDrggMTWGu9KLcLutsnaK8qVWidLBz ipfstest/b/file1.bin
added QmYAi78t3tp3Ajtiqih4HXGRyd2yuH9FPZKj9PfzrxbmhP ipfstest/b/file2.bin
added QmZaq1e5RXNpmn3DoV3B3eocSeUqWjVKUSeYZcReAtwCyd ipfstest/b/file3.bin
added QmeasxZC5qBrqU6QGqAamTuUnpuBHHCQB1c77BxD3A1r8G ipfstest/a
added QmTtGsbBpYLs5y9v3oHrxpvPfxhEDAjRt6u1qYnS8JvHs1 ipfstest/b
added QmV1hsNnmnpcfqyyrthw9WBFBoz7hyx18TwzvvqU1SuCEH ipfstest
@hackergrrl
Copy link
Contributor

Nice catch -- you're right! It looks like we bail before finalizing the FileAdder, which is where we output the directories.

@vitzli
Copy link
Contributor Author

vitzli commented Apr 19, 2016

Seems to be working in add -n mode, traversing directories and outputs directories hashes up to the top dir in the end, thanks!

@vitzli vitzli closed this as completed Apr 19, 2016
@hackergrrl
Copy link
Contributor

hackergrrl commented Apr 19, 2016

Thanks for verifying and reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants