mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 12:57:44 +08:00
Fix "ipfs add -r ." to always add the contents of the current directory.
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
This commit is contained in:
parent
88e4b110ba
commit
10a692f9a2
@ -401,6 +401,10 @@ func appendFile(fpath string, argDef *cmds.Argument, recursive, hidden bool) (fi
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cwd, err = filepath.EvalSymlinks(cwd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fpath = cwd
|
||||
}
|
||||
|
||||
|
||||
@ -189,6 +189,18 @@ test_add_named_pipe() {
|
||||
'
|
||||
}
|
||||
|
||||
test_add_pwd_is_symlink() {
|
||||
test_expect_success "ipfs add -r adds directory content when ./ is symlink" '
|
||||
mkdir hellodir &&
|
||||
echo "World" > hellodir/world &&
|
||||
ln -s hellodir hellolink &&
|
||||
( cd hellolink &&
|
||||
ipfs add -r . > ../actual ) &&
|
||||
grep "added Qma9CyFdG5ffrZCcYSin2uAETygB25cswVwEYYzwfQuhTe" actual &&
|
||||
rm -r hellodir
|
||||
'
|
||||
}
|
||||
|
||||
test_launch_ipfs_daemon_and_mount
|
||||
|
||||
test_expect_success "'ipfs add --help' succeeds" '
|
||||
@ -354,6 +366,8 @@ test_add_cat_expensive
|
||||
|
||||
test_add_named_pipe " Post http://$API_ADDR/api/v0/add?encoding=json&progress=true&r=true&stream-channels=true:"
|
||||
|
||||
test_add_pwd_is_symlink
|
||||
|
||||
test_kill_ipfs_daemon
|
||||
|
||||
# should work offline
|
||||
@ -371,6 +385,8 @@ test_expect_success "ipfs cat file fails" '
|
||||
|
||||
test_add_named_pipe ""
|
||||
|
||||
test_add_pwd_is_symlink
|
||||
|
||||
# Test daemon in offline mode
|
||||
test_launch_ipfs_daemon --offline
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user