ipfs-sync icon indicating copy to clipboard operation
ipfs-sync copied to clipboard

Check for existing files

Open kallisti5 opened this issue 2 years ago • 3 comments

I'm playing with this on our big software mirror... running the sync daemon and adding a test file to trigger ipfs-sync I get pages and pages of...

2021/10/01 11:04:42 Error adding file: cp: cannot put node in path /haikuports/master/x86_gcc2/current/packages/neocd_libretro_x86_source-0.5_20210425-1-source.hpkg: directory already has entry by that name
2021/10/01 11:04:42 Adding file from /home/ipfs/haikuports/master/x86_64/current/packages/assimp_debuginfo-5.0.1-1-x86_64.hpkg to /haikuports/master/x86_64/current/packages/assimp_debuginfo-5.0.1-1-x86_64.hpkg ...
2021/10/01 11:04:42 Error adding file: cp: cannot put node in path /haikuports/master/x86_64/current/packages/assimp_debuginfo-5.0.1-1-x86_64.hpkg: directory already has entry by that name
2021/10/01 11:04:42 Adding file from /home/ipfs/haikuports/master/x86_64/current/packages/libreoffice_cs-7.1.0.3-2-any.hpkg to /haikuports/master/x86_64/current/packages/libreoffice_cs-7.1.0.3-2-any.hpkg ...
2021/10/01 11:04:42 Error adding file: cp: cannot put node in path /haikuports/master/x86_64/current/packages/libreoffice_cs-7.1.0.3-2-any.hpkg: directory already has entry by that name

It seems like checking for the existence of a file in MFS would be better than letting the additional fail? (maybe also comparing the size of the file in MFS and the file on disk)

Ideally it would check the CID of the file on disk vs the CID of the file in MFS, but that might not work out well :-)

kallisti5 avatar Oct 01 '21 16:10 kallisti5