fix(cli): ipfs add with multiple files of same name (#8493)

This commit is contained in:
Lucas Molas 2022-04-03 11:40:38 -03:00 committed by GitHub
parent 5fa556945e
commit 282ac7f1f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 3 deletions

2
go.mod
View File

@ -31,7 +31,7 @@ require (
github.com/ipfs/go-graphsync v0.11.0
github.com/ipfs/go-ipfs-blockstore v1.2.0
github.com/ipfs/go-ipfs-chunker v0.0.5
github.com/ipfs/go-ipfs-cmds v0.7.0
github.com/ipfs/go-ipfs-cmds v0.8.0
github.com/ipfs/go-ipfs-exchange-interface v0.1.0
github.com/ipfs/go-ipfs-exchange-offline v0.2.0
github.com/ipfs/go-ipfs-files v0.0.9

4
go.sum
View File

@ -473,8 +473,8 @@ github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtL
github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw=
github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8=
github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
github.com/ipfs/go-ipfs-cmds v0.7.0 h1:0lEldmB7C83RxIOer38Sv1ob6wIoCAIEOaxiYgcv7wA=
github.com/ipfs/go-ipfs-cmds v0.7.0/go.mod h1:y0bflH6m4g6ary4HniYt98UqbrVnRxmRarzeMdLIUn0=
github.com/ipfs/go-ipfs-cmds v0.8.0 h1:M7apkPxhGe7I3rcKuQ8xRJLIPdaEqaZhJz0uPZEE8EU=
github.com/ipfs/go-ipfs-cmds v0.8.0/go.mod h1:y0bflH6m4g6ary4HniYt98UqbrVnRxmRarzeMdLIUn0=
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=

View File

@ -345,6 +345,27 @@ test_add_cat_file() {
echo "added Qmf35k66MZNW2GijohUmXQEWKZU4cCGTCwK6idfnt152wJ hello2.txt" >> expected &&
test_cmp expected actual
'
test_expect_success "ipfs add with multiple files of same name succeeds" '
mkdir -p mountdir/same-file/ &&
cp mountdir/hello.txt mountdir/same-file/hello.txt &&
ipfs add mountdir/hello.txt mountdir/same-file/hello.txt >actual &&
rm mountdir/same-file/hello.txt &&
rmdir mountdir/same-file
'
test_expect_success "ipfs add with multiple files of same name output looks good" '
echo "added QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH hello.txt" >expected &&
test_cmp expected actual
'
test_must_fail "ipfs add with multiple files of same name but different dirs fails" '
mkdir -p mountdir/same-file/ &&
cp mountdir/hello.txt mountdir/same-file/hello.txt &&
ipfs add mountdir/hello.txt mountdir/same-file/hello.txt >actual &&
rm mountdir/same-file/hello.txt &&
rmdir mountdir/same-file
'
}
test_add_cat_5MB() {