dat icon indicating copy to clipboard operation
dat copied to clipboard

Renaming a folder within a dat creates duplicate files

Open makew0rld opened this issue 7 years ago • 2 comments

I am reporting:

  • a bug or unexpected behavior

Bug Report

  • Operating system: Arch Linux, kernel 4.18.14-arch1-1-ARCH
  • Node Version: 10.12.0
  • Dat Version: 13.11.4

Expected behavior

When I rename a folder within a dat, and then run dat share I expect dat to report the number of files as the same as before, and that the size of the archive according to dat to remain the same as well.

Actual behavior

dat says the total number of files is double the number in the renamed folder, and does the same with the size of the archive. This suggests that dat sees the renamed folder as a bunch of new files, but doesn't delete the metadata (also data?) of the old folder and its (identical) files.

makew0rld avatar Oct 20 '18 20:10 makew0rld

I understand this might be because of how dat is an append-only log. So then I would say then that it might be nice to see a feature where renaming an internal folder doesn't result in duplicates of everything in that folder, which seems a little bit wasteful. The same goes for renaming files, maybe there's a way to store a rename event, rather then store a whole new file or folder of files in the history.

makew0rld avatar Oct 20 '18 21:10 makew0rld

If you do a dat clone of the folder to another directory, do you see the duplicates?

Dat uses an append-only log but that's for the change history. That doesn't mean it's impossible to delete files. If a rename isn't taking effect then something is going wrong in the file-tree diffing algorithm.

pfrazee avatar Oct 21 '18 17:10 pfrazee