@cryptotaxi247 / kubo / commits / 10a692f9a

Fix "ipfs add -r ." to always add the contents of the current directory.

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

Kevin Atkinson committed Aug 27, 2016 at 16:48 UTC 10a692f9a294197fa97afdd5b538cf8116edcecd
2 files changed +20
commands/cli/parse.go
+4
@@ -401,6 +401,10 @@ func appendFile(fpath string, argDef *cmds.Argument, recursive, hidden bool) (fi
401 if err != nil {
402 return nil, err
403 }
404 + cwd, err = filepath.EvalSymlinks(cwd)
405 + if err != nil {
406 + return nil, err
407 + }
408 fpath = cwd
409 }
410
test/sharness/t0040-add-and-cat.sh
+16
@@ -189,6 +189,18 @@ test_add_named_pipe() {
189 '
190 }
191
192 +test_add_pwd_is_symlink() {
193 + test_expect_success "ipfs add -r adds directory content when ./ is symlink" '
194 + mkdir hellodir &&
195 + echo "World" > hellodir/world &&
196 + ln -s hellodir hellolink &&
197 + ( cd hellolink &&
198 + ipfs add -r . > ../actual ) &&
199 + grep "added Qma9CyFdG5ffrZCcYSin2uAETygB25cswVwEYYzwfQuhTe" actual &&
200 + rm -r hellodir
201 + '
202 +}
203 +
204 test_launch_ipfs_daemon_and_mount
205
206 test_expect_success "'ipfs add --help' succeeds" '
@@ -354,6 +366,8 @@ test_add_cat_expensive
366
367 test_add_named_pipe " Post http://$API_ADDR/api/v0/add?encoding=json&progress=true&r=true&stream-channels=true:"
368
369 +test_add_pwd_is_symlink
370 +
371 test_kill_ipfs_daemon
372
373 # should work offline
@@ -371,6 +385,8 @@ test_expect_success "ipfs cat file fails" '
385
386 test_add_named_pipe ""
387
388 +test_add_pwd_is_symlink
389 +
390 # Test daemon in offline mode
391 test_launch_ipfs_daemon --offline
392