Skip to content

Commit

Permalink
fix(cli): ipfs add with multiple files of same name
Browse files Browse the repository at this point in the history
  • Loading branch information
schomatis committed Jan 6, 2022
1 parent 91c5265 commit a27afcf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/ipfs/go-graphsync v0.11.0
github.com/ipfs/go-ipfs-blockstore v1.1.2
github.com/ipfs/go-ipfs-chunker v0.0.5
github.com/ipfs/go-ipfs-cmds v0.6.0
github.com/ipfs/go-ipfs-cmds v0.6.1-0.20211005151237-0e6ec5a05153
github.com/ipfs/go-ipfs-config v0.18.0
github.com/ipfs/go-ipfs-exchange-interface v0.1.0
github.com/ipfs/go-ipfs-exchange-offline v0.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.0 h1:yAxdowQZzoFKjcLI08sXVNnqVj3jnABbf9smrPQmBsw=
github.com/ipfs/go-ipfs-cmds v0.6.0/go.mod h1:ZgYiWVnCk43ChwoH8hAmI1IRbuVtq3GSTHwtRB/Kqhk=
github.com/ipfs/go-ipfs-cmds v0.6.1-0.20211005151237-0e6ec5a05153 h1:CPOUY849Eac0NbZqaBrvZE8LVtXe878OQw1XzgCC4Mg=
github.com/ipfs/go-ipfs-cmds v0.6.1-0.20211005151237-0e6ec5a05153/go.mod h1:y0bflH6m4g6ary4HniYt98UqbrVnRxmRarzeMdLIUn0=
github.com/ipfs/go-ipfs-config v0.18.0 h1:Ta1aNGNEq6RIvzbw7dqzCVZJKb7j+Dd35JFnAOCpT8g=
github.com/ipfs/go-ipfs-config v0.18.0/go.mod h1:wz2lKzOjgJeYJa6zx8W9VT7mz+iSd0laBMqS/9wmX6A=
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
Expand Down
17 changes: 17 additions & 0 deletions test/sharness/t0040-add-and-cat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,23 @@ 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/ &&
mkdir -p mountdir/hello2-content/ &&
cp mountdir/hello.txt mountdir/same-file/hello.txt &&
cp mountdir/hello2.txt mountdir/hello2-content/hello.txt &&
ipfs add mountdir/hello.txt mountdir/same-file/hello.txt mountdir/hello2-content/hello.txt >actual &&
rm mountdir/same-file/hello.txt mountdir/hello2-content/hello.txt &&
rmdir mountdir/same-file mountdir/hello2-content
'

test_expect_success "ipfs add with multiple files of same name output looks good" '
echo "added QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH hello.txt" >expected &&
echo "added QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH hello.txt" >>expected &&
echo "added Qmf35k66MZNW2GijohUmXQEWKZU4cCGTCwK6idfnt152wJ hello.txt" >> expected &&
test_cmp expected actual
'
}

test_add_cat_5MB() {
Expand Down

0 comments on commit a27afcf

Please sign in to comment.